What does = "GetEnvironmentVariableA@12" mean?
BlitzMax Forums/BlitzMax Programming/What does = "GetEnvironmentVariableA@12" mean?
| ||
Hiya, basically you see this:?win32 Extern "win32" Function GetEnvironmentVariable(lpName$z, lpBuffer:Byte Ptr, nSize) = "GetEnvironmentVariableA@12" End Extern ? Why does it need that extra bit on the end after the function is declared? What does it do? Thanks. |
| ||
This is needed for visual studio compiled dlls. Thats a name sheme thing of win32 librarys. What it actually means is that the function takes 12bytes of input. byte ptr, byte ptr, int in this case |
| ||
Hmm OK thanks, so I've got a lot of Win32 externs I've collected and some use that ="blah@N" thing after the function declaration but many don't. Do some need it and others not or maybe none really need it? |
| ||
Its a name-decoration for the stdcall calling convention, when making the DLL some compilers allow you to remove it or redefine the name without it. Edit: Most times Extern "Win32" will get the name right anyway, you really only need the "GetEnvironmentVariableA@12" if you want to name the function something different. |
| ||
some also contain 2 sets of functions one for (Unicode = GetEnvironmentVariableW@12) and one for (ANSI = GetEnvironmentVariableA@12) |
| ||
Aha so W means Wide and A means Ansi, got it. |