Name mangling causes link errors ... how disable mangling?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I need to use a library supplied by someone else: libjpeg.lib. This is a
plain C library. I do not have the source code. I do have the header *.h
files. When I run dumpbin on the libjpeg.lib, it contains symbols (entry
points) like:

jpeg_read_header

I'm trying to link my program with this library. My program is in Visual
C++. The link fails with link-time errors such as:

unable to find function _cdecl_jpeg_read_header(int, char*) [more mangling
stuff]

Apparently, at compile time my compiler is mangling the library function
names (from the library header files) to include the parameter types.

To fix this, I presume, I need to put some instructions into the library's
header files that say "Treat these as normal C functions without mangling".

Any suggestions on how to make the link successful? Thanks in advance for
any help.
neal

.



Relevant Pages

  • Re: Building a monitoring agent - request for comments.
    ... Not just compile time requirements but run time as well. ... header files. ... the real thing -- looking on MS's FAQ for that, it's missing MFC and ... have those systems installed on the PCs that will run this stuff. ...
    (microsoft.public.win32.programmer.messaging)
  • Re: Object-oriented programming in standard ANSI C
    ... structs (e.g. struct Shape) in the header files. ... and made 'private', i.e. static, in the respecive *.c file. ... if it can determine the actual type at compile time. ...
    (comp.lang.c)
  • Re: #include in header file for size_t
    ... Malcolm wrote: ... There's nothing wrong with including header files in header files. ... The waters are muddied further when the compiler supports some form of pre-compiled headers, where a global header that includes all headers can save a significant amount of compile time. ...
    (comp.lang.c)