Hi i am trying to link wine library(msvcrt.dll.so) with my code but i getting segv in _fini call of msvcrt library Please tell me a way so that i can use wine libraries directly without winegcc or specs file
on using winegcc for code which contains new and delete operator it gives undefined reference to following symbols operator new(unsigned) operator delete[](void*) _Unwind_Resume __gxx_personality_v0
please help me to resolve above symbols
waiting for response
Thanks Rajeev
Test Program :
#include <dlfcn.h> #include <direct.h> #include <math.h> #include <stdio.h>
main() { char *a; char *b; double d; void *mod, *ker; const char *error; mod=dlopen("msvcrt.dll.so",RTLD_LAZY); ker=dlopen("kernel32.dll.so",RTLD_LAZY); if(mod) {
if ((error = dlerror())) { printf("Couldn't find getcwd: %s\n", error); }
if(dlsym(mod, "getcwd")){ printf("found"); b=getcwd(a,20); }
dlclose(mod); dlclose(ker); } //end if return (0); } //end main
Build command :
g++ -g -Wall -c -I/home/timex/wine/wine-20040505/include -I. -I/home/timex/wine/wine-20040505/include/msvcrt test.cpp g++ -g -ldl /home/timex/wine/wine-20040505/dlls/msvcrt.dll.so test.o
Debugger output
[me@cvs TUCP]$ gdb -n GNU gdb Red Hat Linux (5.2.1-4) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux". (gdb) file ./a.out Reading symbols from ./a.out...done. (gdb) break test.cpp:10 Breakpoint 1 at 0x80486cc: file test.cpp, line 10. (gdb) run Starting program: /home/a.out
Breakpoint 1, main () at test.cpp:14 14 mod=dlopen("msvcrt.dll.so",RTLD_LAZY); (gdb) next 15 ker=dlopen("kernel32.dll.so",RTLD_LAZY); (gdb) disp mod 1: mod = (void *) 0x40013578 (gdb) disp ker 2: ker = (void *) 0x4026cc40 (gdb) next 16 if(mod) 2: ker = (void *) 0x8049b60 1: mod = (void *) 0x40013578 (gdb) next 19 if(dlsym(mod, "getcwd")) 2: ker = (void *) 0x8049b60 1: mod = (void *) 0x40013578 (gdb) next 20 {printf("found"); 2: ker = (void *) 0x8049b60 1: mod = (void *) 0x40013578 (gdb) next 21 b=getcwd(a,20); 2: ker = (void *) 0x8049b60 1: mod = (void *) 0x40013578 (gdb) step getcwd (buf=0x4026cc40 "T\v\022", size=20) at direct.h:73 73 static inline char* getcwd(char * buf, int size) { return _getcwd(buf, size); } (gdb) step _getcwd (buf=0x4026cc40 "T\v\022", size=20) at dir.c:424 424 int dir_len = GetCurrentDirectoryA(MAX_PATH,dir); Current language: auto; currently c (gdb) step 422 { (gdb) step 424 int dir_len = GetCurrentDirectoryA(MAX_PATH,dir); (gdb) step 422 { (gdb) step 424 int dir_len = GetCurrentDirectoryA(MAX_PATH,dir); (gdb) step
Program received signal SIGTRAP, Trace/breakpoint trap. 0x40062179 in _fini () from /home/timex/wine/wine-20040505/dlls/msvcrt.dll.so (gdb) bt #0 0x40062179 in _fini () from /home/timex/wine/wine-20040505/dlls/msvcrt.dll.so #1 0x08048790 in getcwd (buf=0x4026cc40 "T\v\022", size=20) at direct.h:73 #2 0x08048730 in main () at test.cpp:21 #3 0x40161b84 in __libc_start_main () from /lib/libc.so.6 (gdb)
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.642 / Virus Database: 410 - Release Date: 3/24/2004
On Mon, May 31, 2004 at 05:16:47PM +0530, Rajeev Bansal wrote:
Please tell me a way so that i can use wine libraries directly without winegcc or specs file
Please don't do that. Or if you do, I'm afraid we can't help you.
on using winegcc for code which contains new and delete operator it gives undefined reference to following symbols operator new(unsigned) operator delete[](void*) _Unwind_Resume __gxx_personality_v0
please help me to resolve above symbols
Use wineg++ to compile and link.