Skip to content
⌘ NSIS Forum Archive

"symbol not found" when compiling plugin in clang

3 posts

parasoul#

"symbol not found" when compiling plugin in clang

Hi,
I'm having a clang issue (Anders - you mentioned clang in one of your previous responses to my post, so I thought I'd give it a try)

Here's some simple code illustrating the problem:

extern "C" void __declspec(dllexport)  TEST(int num)
{
    return;
} 
When it tries to link, clang returns this as an error:
Cannot export _TEST: symbol not found
Problem is, I can't find a way to prevent clang from mangling names.

Anders, since you use clang to (I assume) produce shared libs, I thought you'd be a good person to ask !

thanks for the time
Anders#
I only said clang would be next on the list of compilers we would support in a thread about Borland. I have not used it myself but I know it is somewhat MSVC compatible.

It would help if you tell us your compiler version and the switches you used (-fms-extensions? -fms-compatibility? -fmsc-version=?).

http://clang.llvm.org/docs/MSVCCompatibility.html claims support for __declspec(dllexport) so other than changing "__declspec(dllexport)" to "__declspec(dllexport) __cdecl" I don't have any suggestions unless clang also supports .def files.
parasoul#
Originally Posted by Anders View Post
I only said clang would be next on the list of compilers we would support in a thread about Borland. I have not used it myself but I know it is somewhat MSVC compatible.

It would help if you tell us your compiler version and the switches you used (-fms-extensions? -fms-compatibility? -fmsc-version=?).

http://clang.llvm.org/docs/MSVCCompatibility.html claims support for __declspec(dllexport) so other than changing "__declspec(dllexport)" to "__declspec(dllexport) __cdecl" I don't have any suggestions unless clang also supports .def files.
Thanks for the reply Anders

The solution turned out to be removing __declspec(dllexport). Clang still produces a valid export to my plugin function.