This is the mail archive of the cygwin 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: Building cpan module that links with proprietary libs

On 05/30/2014 04:01 AM, Csaba Raduly wrote:
On Fri, May 30, 2014 at 4:36 AM, Andrew DeFaria  wrote:
On 5/29/2014 6:42 PM, Larry Hall (Cygwin) wrote:
As a
result, you will never get code compiled with g++ to link with these
libraries.  There is no common ABI among C++ compilers.  Thus, the
and headers of one can't be used as input to the compiler of another, even
on the same platform.  This only works for C code.  So you have to either
build the proprietary libs with Cygwin's C++ compiler or write your own
"shim" library that wraps the necessary calls and objects in a C API,
compile that with VS, and link your program against the APIs in your

@Larry: Would this work? I think MSVC produces obj and lib files in
COFF; can Cygwin's toolchain understand that?

What I'm suggesting is not all that different than using Windows native
platform or other libraries with Cygwin.  So yes, what I'm suggesting will
work and is the typical approach taken to use C++ libraries built by a
different compiler.  It's a pain but it works.  In this case, you just
have to wrap the class methods you want to use in C functions, declare then
'extern "C"', __cdecl, and __declspec(dllexport) (if you decide to make
your "library" a DLL).  Build that with VS and include the .lib at the
end of your invocation of 'gcc'.  Simple.  :-)



A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

Problem reports:
Unsubscribe info:

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