X-Spam-Check-By: sourceware.org Message-ID: <5f0807670708180346vb308d41h6c574e3ffe5f1f05@mail.gmail.com> Date: Sat, 18 Aug 2007 03:46:02 -0700 From: "Pradip Jadav" 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 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 Precedence: bulk List-Id: List-Unsubscribe: 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 On 8/11/07, Brian Dessent 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/