Hi,
I just got problems with a couple of functions, I need to use from an extern dll.
If I prototype the function as following: int xxxxy();
I can use it as I wish, but I won't get an error if I acidently call it with the wrong number of arguments.
If my protype looks like following: int xxxxy(DWORD*,DWORD,DWORD);
Then the linker complains since it looks for _xxxxy@12, but since I only have the lib and there the function is declared as _xxxxy the linker can't find it.
Is there a compiler-option for disabling this name mangling?
Thanks in advance
Have you tried the /Gm option?
Hi Dav92,
You can recreate the import library without decorated names :
/NOUND Don't add underscore to import names
QuoteHave you tried the /Gm option?
Thanks, that indeed solved the problem. But created another one. The windows api functions use the standard nameing conventions, so is there a way to use the /Gm only for specific functions?
QuoteYou can recreate the import library without decorated names
Thanks, but the underscores aren't the problem. The problem is the @.. The lib got created without knowing the number of args or the calling convention for the functions.
Hi Dav92,
Another solution would be to recreate the same library with decorated symbols. (http://www.masm32.com/board/index.php?topic=6390.0) Could you post the exact list of functions with the number of parameters?
That's the problem. most of the functions I haven't used so far, so I don't know the parameters of them.
But since I wrote myself the def-file I can easily recreate the lib if I use a new function with the number of parameters.
I'll write a small batch-file for creating the lib and then just recreate it everytime I use a new function
Hi Dav92,
The code below is not a perfect solution but it seems to work :
extern int MessageBoxA();
int __stdcall MessageBox(int x,char *y,char *w,int z)
{
int temp;
__asm{
push z
mov eax,w
push eax
mov eax,y
push eax
push x
call MessageBoxA
mov temp,eax
}
return temp;
}
int __stdcall WinMain(int hInstance, int hPrevInstance,char *lpCmdLine, int nCmdShow)
{
MessageBox(0,"Undecorated function call","Hello",0);
return 0;
}
Yes, that would work, but would be too much work^^
I think I'll just stick with recreating the lib every time I use a new function.