Author Topic: how to determine if compiling for 32 or 64-bit  (Read 708 times)

0 Members and 1 Guest are viewing this topic.

jack

  • Guest
how to determine if compiling for 32 or 64-bit
« on: June 27, 2019, 03:44:05 AM »
in a very simple test, I need to declare a library function differently depending whether it's being compiled for 32 or 64-bit, how would you do that?
I am thinking that there probably is a way using the preprocessor, but have no clue how.

Arnold

  • Guest
Re: how to determine if compiling for 32 or 64-bit
« Reply #1 on: June 27, 2019, 04:51:07 AM »
Hi Jack,

for one of my projects I keep the dlls in two different folders and decide with mode64bit what dll to use:

Code: [Select]
$ filename "HelloWorld1.exe"

'uses rtl32
'uses rtl64

includepath "../include/" 
#ifndef mode64bit     
   extern lib "../IUP32/iup.dll"
   uses "iup.h"   
   end extern
   extern cdecl
#else
   extern lib "../IUP64/iup.dll"
   uses "iup.h"   
end extern
#endif


sub main()

  IupOpen(0,0) 
  IupMessage("Hello World 1", "Hello world from IUP.")
  IupClose()

end sub

main()

I suppose there are some more options.

You can also find examples of using mode64bit e.g. in \inc\Msvcrt.inc and inc\MinWin.inc

Roland

jack

  • Guest
Re: how to determine if compiling for 32 or 64-bit
« Reply #2 on: June 27, 2019, 06:05:42 AM »
thanks a lot Arnold, just what I needed  :)
offtopic, in my little test, Windows defender would block my program from running after I had added the statement: printl Len(s)
if I would assign Len(s) to a variable and then print that variable it was ok