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: Creating dll in cygwin gives "Undefined reference" errors


On 8/11/07, Brian Dessent <brian@dessent.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/


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