delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/05/04/09:48:22

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Tue, 4 May 2004 09:47:20 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: john george <jgsave AT yahoo DOT com>
cc: cygwin AT cygwin DOT com
Subject: RE: Trying to link an MSVC DLL with a Cygwin Application
In-Reply-To: <20040504055710.27230.qmail@web20604.mail.yahoo.com>
Message-ID: <Pine.GSO.4.56.0405040943260.12231@slinky.cs.nyu.edu>
References: <20040504055710 DOT 27230 DOT qmail AT web20604 DOT mail DOT yahoo DOT com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Mon, 3 May 2004, john george wrote:

> --- "Billinghurst, David (CALCRTS)" <david<dot>billinghurst<at>comalco<dot>riotinto<dot>com<dot>au> wrote:

<http://cygwin.com/acronyms/#PCYMTNQREAIYR>.

> > > From: john george
> > >
> > > I'm trying to link a MSVC++ created DLL with a cygwin application.
> > >
> > > ...
> > >
> > > This gives me undefined refernce to function name
> > ...
> > >
> > > Is there anything that I'm missing?
> >
> > The g++ and MSVC++ mangle C++ names differently.  This makes it very
> > difficult (perhaps impossible) to link a MSVC++ created DLL with a g++
> > compiled (cygwin or mingw) application.
>
> Can i resolve the name mangling issue by adding the extern "C"
> declaration for every function that I'm exporting in the MSVC created
> DLL.  I tried this but doesn't seem to work.  Is there any other way to
> do this.

Theoretically, the above should have worked, as long as you turned off
name mangling on *both* ends (i.e., declared the exported functions as
'extern "C"' in both the MSVC DLL, and your program headers).

Checking whether the undefined reference is to the mangled name or not
should tell you on which end you forgot to 'extern "C"' the function.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019