[LLVMdev] Problems linking shared library with __declspec(dllexport)

Ronald Pijnacker pijnacker at dse.nl
Sun Oct 11 23:47:54 PDT 2009


> > I am trying to use llvm-gcc to link shared libraries on windows/mingw32.
> > When I try to link libraries that contain functions declared with
> >  __declspec(dllexport) someFunction();
> >
> > I get the link error:
> >
> >  Cannot export _someFunction: symbol not found
> dllexport declspec should be put on the function definition, in this
> example there is nothing to export - dllexport without function body
> is meaningless.

Ok, you're right.
The declaration is actually there in the function definition.
Sorry to provide a broken example.
Here is a more acurate one:

--- function.c
  __declspec(dllexport) someFunction()
  {
      printf("Hi\n");
  }
---

Compiling this gives:

  $ llvm-gcc -shared -o libfunction.dll function.c
  Cannot export _someFunction: symbol not found
  collect2: ld returned 1 exit status

Thanks,

Ronald



More information about the llvm-dev mailing list