LNK2028, LNK2019 without extern "C"

I wrote a Win32 dll in VS2005 and a CLR-Console client, the CLR-Console client is the caller of Win32 dll. In the Win32 dll, using /TC compiler option to build it and using /clr option to build the CLR-Console client. The all things is fine, such as 'dllexport/dllimport', 'Additional Include Deirectories' and 'Additional Dependencies'. But I got LNK2028 unresolved token and LNK2019 unresolved external symbol, the reason is I forgot using the extern "C" to include all dllexport functions.

1 comment:

yinyh said...

please help me to explain why my progamme create a lnk2019 error, the programme is following:

test error LNK2019: unresolved external symbol _SetURL@8 referenced in function _main

extern "C" __declspec( dllexport ) void WINAPI SetURL(LPCTSTR lpctstrURL, LPCTSTR lpctstrPORT)

memo: dll file compiled with the compiler using /clr option

please help me, i wait for your reply, contact me with: yyh9186@hotmail.com, thank you!