Visual studio: question about linking functions between two projects

前端 未结 2 1948
迷失自我
迷失自我 2021-01-24 03:19

I guess this is a newbie question, but anyway. I\'ve got a solution composed of two projects (1 DLL and 1 console app). The console app includes some headers from the DLL projec

2条回答
  •  旧巷少年郎
    2021-01-24 03:41

    I'm going to guess you use Visual Studio and don't know about dllexport.

    Visual Studio by default does not export the names of your functions on the outside of your DLL. To do so you need to tell it that explicitly:

    __declspec(dllexport) void f() {...}
    

    and on the side of the one using the DLL:

    __declspec(dllimport) void f();
    

    That way the second one will use the imported function and the first will export it.

提交回复
热议问题