c++ - DLL project on Windows: Unresolved External Symbol -


i'm creating dll project visual studio 2012 intent of calling functions delphi project. i've turned off c++ name mangling wrapping functions in extern "c" { /* ... */ } avoid c name decoration, i'm using def file.

here's snippet of code describing how have things laid out:

// myfile.h  #ifdef myproject_exports #define myproject_api __declspec(dllexport) #else #define myproject_api __declspec(dllimport) #endif  extern "c" {     extern myproject_api void __stdcall do_something(); } 

the .cpp file equivalently structured. matches fine.

i added .def file project folder containing following content:

library myproject exports     do_something=_do_something@0 

when build project, works okay. when add linker option

/defs:myproject.def 

i start getting errors regarding unresolved external symbols. has had kind of issue before? i'm not new either c++ or c first time building dll on windows, i'm unix developer. hypothesis i'm either misunderstanding or misusing __declspec decorator, breaks when link in def file: when remove flag linker options builds cleanly, except c-style decorated symbols.

edit: comments everyone, i've gotten myself figured out now. issue came fact using def file during linking phase during creation of dll. need use def file when using dll, not creating it, , peachy.

thanks comments everyone, i've gotten myself figured out now. issue came fact using def file during linking phase during creation of dll. need use def file when using dll, not creating it, , peachy.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -