Pelles C forum

C language => Expert questions => Topic started by: czerny on August 19, 2009, 08:20:09 PM

Title: zlib dll decoration
Post by: czerny on August 19, 2009, 08:20:09 PM
Hallo,

I would like to compile zlib as a dll.

The zlib doc says:

  * The symbols are exported by name, not by ordinal.
  * The exported names are undecorated.
  * The calling convention of functions is "C" (CDECL).
 
But I can not find a compiler-option for undecorated cdecl.

What is the right switch?

czerny
Title: Re: zlib dll decoration
Post by: Vortex on August 19, 2009, 08:34:44 PM
Try to build your project, do you get any error messages? According to the manual, MS VC++ is supported, you should be able to use the library with Pelles C.
Title: Re: zlib dll decoration
Post by: czerny on August 19, 2009, 10:00:39 PM
Hmm,

what do you mean with 'use the library'? A precompiled dll?
That's not the problem. I would like to compile it myself.

czerny
Title: Re: zlib dll decoration
Post by: TimoVJL on August 20, 2009, 07:02:02 AM
If you make static library, select from project options Calling conv: __cdecl
Title: Re: zlib dll decoration
Post by: czerny on August 20, 2009, 12:56:15 PM
If you make static library, select from project options Calling conv: __cdecl
I don't understand!
I do not want to make a static lib. I want to make a dll.
__cdecl is clear. But how to get undecorated symbols?

czerny
Title: Re: zlib dll decoration
Post by: czerny on August 20, 2009, 01:02:09 PM
Hi,

maybe it is not clear what I want.

There is a compiler-switch /Gm and /Gn for undecorated fastcall and stdcall.
What is the equivalent switch for cdecl?

czerny
Title: Re: zlib dll decoration
Post by: Vortex on August 20, 2009, 08:17:41 PM
Hi czerny,

The cdecl convetion does not decorate functions like stdcall. It adds only a leading underscore to the symbols.