|
Post by jcfuller on Dec 16, 2010 15:49:22 GMT 1
Peter, Is it possible (or could it be added) to create a callback function that uses __stdcall. Or IMPORT from a library function that uses __stdcall? I am under the impression (maybe wrongly) that all procedures now use __cdecl?
James
|
|
|
Post by Pjot on Dec 17, 2010 7:36:26 GMT 1
Hi James, Well, as far as I understand calling conventions, the convention is determined by the compiler. BaCon simply translates keywords to C code and GCC in its turn compiles to a binary, thereby determining the calling convention. On Unix based systems this is indeed 'cdecl'. So if you would compile the generated C code on a different platform then the compiler on that platform decides the needed calling convention. For Win32 the MinGW compiler would decide for 'stdcall'. It is therefore not up to BaCon to decide what calling convention should be used. Nevertheless you may want to pass some options to GCC - you always can do so when invoking BaCon using the '-o' parameter. Best regards Peter PS: BaCon uses the default Unix 'dlopen' API to import anything from a shared library. So you have to make 'dlopen' understand it opens a 'stdcall' library but I wonder if this is possible at all. There is an interesting article explaining some options for GCC, maybe this helps. Another approach would be to compile the target library in a way so it is compatible with 'dlopen'.
|
|