Check if program has been compiled for 32 or 64 bits

Asked

Viewed 42 times

2

Good afternoon, I am setting up my fpc here for cross-Pilation and would like to make sure that it is working properly, I want to do a test program and compile on each platform, soon after checking that each executable has been compiled to the correct platform.

In C++ I used the result of sizeof(void*) (as the comments of that question) as a basis, but I do not know if there is a precise equivalent in Pascal.

So, what is the best way to programmatically detect under which type of CPU the executable is running (not what type of OS)?

  • In the compilation process, the word size is already set. There is no way the program can adapt after it has been compiled.

  • According to that reply from Soen, Pascal has no types dependent on machine architecture

  • Well, the example above the sizeof I used as an example, it wouldn’t have to be that way. So there’s really no way to detect whether the program is 32 or 64 in the pascal?

  • From what I’m interpreting, no. It’s your concern to ensure that you built the x86 in the right place, as well as the x86_64. Maybe even your Pascal build runs on a VM... but I’m working on it even better

  • Okay then, thank you

  • 1

    SizeOf(pointer)? https://stackoverflow.com/q/18771293/4438007

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.