Pelles C forum

C language => Beginner questions => Topic started by: BertBulaba on April 09, 2009, 03:29:26 PM

Title: DLL
Post by: BertBulaba on April 09, 2009, 03:29:26 PM
I have a problem with code for a dll originally written in VC++ 6. It compiles fine in VC++ 6, but I want to port it to C in order to get away from .NET. The culprit seems to be this piece of code:

#define PLUGINAPI extern "C" __declspec(dllexport)

I get the following warnings and errors:

warning #2099: Missing type specifier.
error #2014: Empty declaration.
error: expected ';' but found 'string constant'.
error #2156: Unrecognized declaration.

I have tried many different solution but I just cannot get it to work  ???. Anyone?
Title: Re: DLL
Post by: Stefan Pendl on April 09, 2009, 03:59:47 PM
There is no extern C in C, extern C is only valid for C++.
Title: Re: DLL
Post by: BertBulaba on April 09, 2009, 04:49:55 PM
Well it seems like sometimes you are staring at the problem so hard that you cannot see what is infront of you!
Thanks!

Now another problem popped up which I have no idea what it is:

POLINK: error: Unresolved external symbol '__imp__VirtualFree'.
POLINK: error: Unresolved external symbol '__imp__HeapCreate'.
etc... all 26 of them in total

What is POLINK and what kind of errors are they? They are not related to the code I have though, so it must be something else.

Title: Re: DLL
Post by: Stefan Pendl on April 09, 2009, 05:20:20 PM
Seems there is one .LIB file missing from the project properties, where those two external functions are included.
Title: Re: DLL
Post by: BertBulaba on April 09, 2009, 05:42:06 PM
It now compiles - it was due to some settings in the Project Options.

:( Unfortunately the API doesn't load the dll. It has no problems with the dll compiled with VC++ 6. Any ideas?