LouisPeter

Hi,

I have an MFC DLL and I wanted to use the LoadLibrary function to call a function from another DLL. Can someone explain how should I do it I've tried the example of the MSDN but it gives errors. Should the LoadLibrary("path of DLL") be enough or do I have to do something else Thanks



Re: Visual C++ General Using LoadLibrary

Sdi

If your code won't work correctly if you can't call the other DLL function, LoadLibrary() doesn't buy you much; run-time linking is only of value when you want to call a function that may not be present (product or version issues) and you can handle the case where you can't call the function. If you only use the other function in rare cases, you can avoid paying the cost of loading the other DLL when your DLL is loaded by using LoadLibrary(), but you can accomplish the same thing by delay-loading the other DLL.

All LoadLibrary() needs is the name, optionally with the path, of the DLL. What does you GetLastError() code that handles the LoadLibrary() failure say





Re: Visual C++ General Using LoadLibrary

Simple Samples

There are many sample uses of LoadLibrary. Have you solved the problem If not, then what is the error you are encountering




Re: Visual C++ General Using LoadLibrary

LouisPeter

Well the full project is a C# device application that calls a DLL function, which in turn calls a function from another DLL. I've tried to declare the DLL's implicitly using the commands DllImport and DllExport but I get the folowing error: "Can't find PInvoke DLL 'Storage card/c_dll.dll'". So instead of declaring the DLLs implicitly I tried the explicit way, using LoadLibrary. But I get the same error...It has to be a Compact Framework problem because I have a similar project in a Windows App and the implicit call works just fine.



Re: Visual C++ General Using LoadLibrary

Ramkrishna Pawar

Where is this DLL located Are all the dependancies of this DLL in same location Or path