This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DLLs that can be used with MS C++

Dan Kyhl wrote:
> Are you saying that I can't make C++ dll's in cygwin for use in 'normal'
> Windows?

No, because every C++ compiler "mangles" identifiers differently.  Name
mangling is considered by many to be a feature.  Even your own company's
C++ compilers probably mangle names differently from VC++ and g++.  They
may even mangle names differently from _each other_.

Now, if you're not trying to call methods, but instead calling plain ol'
functions that don't take objects or pointers to objects as parameters,
you can prefix the functions with 'extern "C"' and it will export those
names unmangled.  Such functions can use objects internally, but you
can't pass them in and out because object layout might be different
between your two compilers.

> There's not even a native gcc for Windows?

mingw qualifies, but the name mangling issue still pertains, since
underneath it's still g++.  This is not a "Windows" issue, it's a
compiler issue.  Other native Windows compilers -- including IBM
VisualAge -- don't interoperate with each other at the C++ level.

This is one reason why COM, .NET and Java exist.  They define a single
object model so cross-language and cross-tool calls work right.  It's
also why there is no C++ API for Windows.

This is getting pretty far afield from Cygwin, though.  If you want to
take it up further, you should probably go to comp.lang.c++{.std} or
reply by private email.

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]