Click to See Complete Forum and Search --> : .net dll problem


sgclement
April 16th, 2004, 11:51 AM
I have encountered a funny little problem.

I have an mfc dll written with VC++ 6, and have upgraded it
to .net 2003. I am able to call functions from this dll ok.

However when I create a mfc dll using VS .net 2003, I am having
difficulty calling it functions. I have used the same syntax
as the earlier dll which works, however I am getting
an "unresolved external error" when I try to build the
exe calling the dll functions.

I have checked the "additional include directories", and
"additional library directory" settings, and they all seem
fine.

Anybody encountered this problems before ? or am I
doing something really stupid

cheers

simon

OReubens
April 16th, 2004, 12:07 PM
You have added the path to the DLL headers to the include directory, and you've added the path to the Dll importlib in the library directory...

But you have probably forgotten to explicitely link in the DLL's importlib.

You can do this either by specifying the lib in the linker settings,
or via a pragma in the code.
#pragma comment(lib, "MyDll.lib")

Andreas Masur
April 16th, 2004, 02:52 PM
[Moved thread]

Andreas Masur
April 16th, 2004, 02:53 PM
Your problem might come from different versions of the MFC dll. Visual Studio .NET comes with a new MFC library which was partly redesigned and rewritten. Thus, it is not compatible with the old one.

sclement
April 18th, 2004, 09:33 AM
Hi

Thanks for the suggestions. I should have made clear that
I'm calling the dll function from an atl exe server.

It seems to work ok when calling from a mfc exe.

cheers

simon