X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:reply-to:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=byRHjwnRc6OjzKKg gZ9EzNjHeWxnEkHPDSLBOJKQK3ndJAG2AZLghKmqqj1iYYtPJzapCgti46+Q9eQD chBMWVeTdc15m9tB2zktTMAzmIALGczFCVeEMrVcM/4Qbr+s8639SwAy0lobdKrj Os1ieLVh4ln0b3pOdwS7wRfER7U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:reply-to:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; s=default; bh=qxfQN0Z7K6HqUuRq3iQqBg HrvOE=; b=FUZK2svGrVkEfp38Tz12QBLz3XRYUZT0k3PYvpuFT21WkSOtPVDsdQ plgEve9PRChRASKr/S3Xc08LhMYZs338tR0ySUiYFXZxS5Kw7xewqBgApQSbnuLW DF8OijlNeQk0Uo/IzbEHCqg0DQgTHHcl/kHGLUaCpsE4Dhjah4r7Y= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: vms173023pub.verizon.net Message-id: <5388B5E1.4050209@cygwin.com> Date: Fri, 30 May 2014 12:46:25 -0400 From: "Larry Hall (Cygwin)" Reply-to: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Building cpan module that links with proprietary libs References: <5387E20D DOT 7090806 AT cygwin DOT com> In-reply-to: Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit 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 >>> libraries >>> 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 >>> library. > > @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. :-) -- Larry _____________________________________________________________________ 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: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple