Search code examples
c++.netdlldynamic-linkinggetprocaddress

C++ how to dynamically load a 3rd party DLL file


I need to integrate a 3rd party DLL file with my application, I have only the .DLL and the .pdf documentation of the DLL.

This is the pdf of the dll: http://www.whiteboxrobotics.com/Support/pdf/PC-BOT_dotNet_v1.0_documentation.pdf

I can load the DLL in Visual Studio just by dragging it into the toolbox, BUT, I would like to know how that is done in coding.

Since I only have the DLL, I guess the only option is dynamic loading, using the LoadLibrary() and GetProcAddress().

But it seems to be such a hassle, and I can't figure out how I would load any of the functions which receive some custom (enum) parameters, e.g. in the .pdf the function SendMessage(...) which takes PCBOTEventArgs.messageType as one of the parameters.

Yet loading the DLL through the design view is so simple and extracts the whole DLL.

Why is that?

Is there something else besides using function pointers and GetProcAddress()?


Solution

  • A dotNET = (Mircosoft) .NET Framework is not the same as a "normal" dll, you can't use GetProcAddress and LoadLibrary with .NET dlls

    .Net Dlls are normally packed classes, by dragging the dll into your workspace you just import the dlls scope, see for your self in the object browser

    to load a .net dll (Assembly) during runtime, for example for a plugin, look here http://support.microsoft.com/kb/837908