How to dllimport in Microsoft Visual C++

后端 未结 3 1624
猫巷女王i
猫巷女王i 2020-12-18 04:44

I have a DLL and I would like to use some of its functions.

#include 

using namespace std;

extern \"C\" __declspec(dllimport) int Initializ         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-18 05:15

    Under visual studio you can't link directly to DLL, you need import library.

    So basically you have several options:

    1. Create import library form dll and link to it. There are some tools coming with MinGW that do the job, they may actually work for you, AFAIK there are also some tools for MSVC.

      This can be helpful: http://support.microsoft.com/kb/131313, not tested myself

    2. Use GetProcAddress
    3. Use gcc as it know to link directly with DLL's without import library :-)

提交回复
热议问题