views:

894

answers:

3

I figured out through trial n error how to link an unmanaged static library to managed C++ dll, but I have no idea how to dynamically include a DLL. Does anyone know how to do this in Visual studio 2008?

A: 

Calling the unmanaged "LoadLibrary" does not work?

Sesh
A: 

I'm trying to link CAIR into my managed assembly. CAIR depends on pthreads, a static or dynamic library for accessing posix functions of any OS.

This doesn't make sense to me, but the solution was to include the pthreads.lib file into the managed C++ assembly AND dynamically link pthreads.dll into the managed library as well as all consumer projects.

I was under the impression I didn't need the dll if I statically compiled the lib into my managed assembly.

CVertex
A: 

Hm I'm not sure about the exact details of why this happens, but I use a library called OpenCV and I have to both statically link a lib file and dynamically link a dll file. So I think it's quite normal for it to be this way. I think part of the reason for this is that if the library vendor updates the library, they can just distribute a new dll file and your code will automatically work with it - you don't have to recompile their whole program each time the library is updated.

Ray Hidayat