Assembly and C++
Hi guys, I have asked this question on other forums and no one seems to know the answer...
I wrote a dll in assembly to test the functionallity between ASM dll's and C++. I am however lost. After compiling the following ASM code into a DLL :
I started a new VC++.NET Console project. I went to msdn and read up on loading dll's. So I went ahead and used LoadLibrary and sure enough the dll was loaded. After this success I used GetProcAddress to find "MyTest2", and everytime it returns NULL.
MyTest Proto :DWORD
DllMain proc hInstance:HINSTANCE, reason:DWORD, reserved1:DWORD
MyTest proc mynum:DWORD
Is it possible to use ASM dll's in C++? If so, do you know of a resource I could look at or possibly have some source? Any help is appreciated. :)
Most likely reason is that the function isn't listed in the export list of the DLL. Loading it into the dependency viewer could confirm that.
The solution would be a .def file fed to the linker.
It should also be mentioned that Test1 doesn't honor the __stdcall convention, which is the usual convention in DLLs. Neither does it honor the naming convention for __stdcall. And finally, it simply has no visible effect, because it increments a copy of the number passed. (I think. I'm not very familiar with MASM syntax.)
ok, I was not aware of that! arg! You are correct, it increments a number passed to it... which is just a test, since I want to get it working before i write a few hundred lines of ASM.
Ok, is there a msdn or such resource for __stdcall that I could look at and make compatible?
You clean the stack by using the ret instruction with an argument, e.g.