I have produced a dll with MASM and used a def file to export 1 function.....

I can use the .lib to statically link to this dll with another MASM program.....No problem

But I tried to use this dll with VC++ and I cant get the static link.....It complains that the symbol is unresolved......
I tried to declare it "extern "C"" but still to no avail........

Is there any easy way to fix this? Or am I stuck with dynamic linking?

Thanks in advance
Posted on 2002-07-02 15:34:29 by Fordy
What symbol is the compiler looking for (it's exact name)?
You should use extern "C" at least unless you want to figure out the ugly C++ name decorations.. However did you use the right calling convention? The default in masm is STDCALL while C uses cdecl. Try adding __stdcall to your C function header.

Thomas
Posted on 2002-07-02 15:38:35 by Thomas
Ha...excellent...the __stdcall worked.....

I didnt consider that!

Thank you very much
Posted on 2002-07-02 15:41:36 by Fordy
Just to be anal: you don't link statically to a DLL. To link statically
means to include code from a .lib file in your executable. When you
include an import library for a DLL, you link implicitly - not statically :).
LoadLibrary + GetProcAddress is explicit linking/loading of a DLL.
Posted on 2002-07-03 05:28:05 by f0dder