"win32" = stdcall ?

BlitzMax Forums/BlitzMax Beginners Area/"win32" = stdcall ?

jpavel(Posted 2009) [#1]
It was my (possibly flawed) understanding that BlitzMax's "win32" is equivalent to the stdcall calling convention.

Most Windows DLL's use stdcall, yes?

But in the forums, for instance here

http://www.blitzmax.com/Community/posts.php?topic=49855

I've seen code like this

' Function declaration...

Global DoIt (x, y)

' Load DLL...

lib = LoadLibraryA ("mylib.dll")

If lib
    ' Assign DLL function to function pointer...
    DoIt = GetProcAddress (lib, "TestFunction")
Else
    Print "Died painfully..."; End
EndIf

Print DoIt (1, 2) ' Calls TestFunction (x, y) from mylib.dll with 1, 2 as parameters


Wouldn't one need to annotate the definition of the function pointer DoIt() with "win32" so that the function from the DLL gets called properly?

Thanks!
~Jesse


Kev(Posted 2009) [#2]
when i wrapped winblitz3d's .dll to a blitzmax module i define the dll function pointers before getting there address from the dll

download my winblitz3d blitzmax wrapper it contains the source code to the module that will show you how i wrapped the dll functions


jpavel(Posted 2009) [#3]
Thanks Kev - your code matches exactly what I thought should be going on (all the dll function pointers decorated with "win32")!


Azathoth(Posted 2009) [#4]
It depends what calling convention the dll uses.