delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/08/18/06:46:22

X-Spam-Check-By: sourceware.org
Message-ID: <5f0807670708180346vb308d41h6c574e3ffe5f1f05@mail.gmail.com>
Date: Sat, 18 Aug 2007 03:46:02 -0700
From: "Pradip Jadav" <pradipjadav AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Creating dll in cygwin gives "Undefined reference" errors
In-Reply-To: <46BE2930.279C8C7@dessent.net>
MIME-Version: 1.0
References: <5f0807670707280532t44a7d607vf92a06231313d5d9 AT mail DOT gmail DOT com> <5f0807670707280535u71d26ef6s4b0af545f30cd04f AT mail DOT gmail DOT com> <46AB5AFF DOT A5AA4C8E AT dessent DOT net> <5f0807670708110341m5fc98238j12697c696c6b3c AT mail DOT gmail DOT com> <46BE2930 DOT 279C8C7 AT dessent DOT net>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

On 8/11/07, Brian Dessent <brian AT dessent DOT net> wrote:
> g++ -o main.exe main.o -ldl -Wl,-out-implib,libmain.dll.a

I tried this, but it gives same "Unresolved reference" errors. I will
do R&D on this and excluding "__declspec" part later.

But currently I am going with "__declspec " part . Using it, gives
something weired problem.

In my dll code there is a call of a class which is defined in main program.

"extern Workers oworkers;"

But at time of compilation, It gives me error like,

------------------------------------------
$ g++ -shared -o sample.dll sample.c -L. -lmain
fu000001.o:(.idata$2+0xc): undefined reference to `_libmain_dll_a_iname'
fu000002.o:(.idata$2+0xc): undefined reference to `_libmain_dll_a_iname'
fu000003.o:(.idata$2+0xc): undefined reference to `_libmain_dll_a_iname'
fu000004.o:(.idata$2+0xc): undefined reference to `_libmain_dll_a_iname'
fu000005.o:(.idata$2+0xc): undefined reference to `_libmain_dll_a_iname'
fu000006.o:(.idata$2+0xc): more undefined references to
`_libmain_dll_a_iname' follow
nmth000000.o:(.idata$4+0x0): undefined reference to `__nm__workers'
Info: resolving _workers by linking to __imp__workers (auto-import)
collect2: ld returned 1 exit status
------------------------------------------

With the help of your reply, I changed my use of class to,
__declspec(dllimport) extern Workers oworkers;

And it compiles successfully.

But at time of execution, it gives me dlopen error like,
dlopen : No such process

Whats wrong here now?



-- 
Regards,
Pradip K. Jadav
(Mob.)+91-9323315353

--
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