Thread: [Dev-C++] problem using dll from visual studio
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Axel B. <new...@th...> - 2004-04-20 18:10:13
|
Hi Folks, I'm new to the list because I couldn't find a solution to this little problem. I am trying to use the sleepycat berkeley db 4.2, compiled under visual studio 6, with dev-c++. but this won't work - when linking I always get the following error: [Linker error] undefined reference to `Db::Db(DbEnv*, unsigned)' this bugs me. I tried to include the .lib-file by -l switch, directly, I set the include/library paths, I tried to include the .a file, etc. nothing works. AND I checked with nm that the lib indeed HAS the functions included - the cxx_*.obj-files are present in the lib. so - I'm clueless :-/ can anyone please help me, its kind of important ... :-) thanks in advance & greetings, axel. |
|
From: Axel B. <new...@th...> - 2004-04-20 20:32:14
|
Ok, this is the last email I'll write. I have figures something out: I simply tried to call a C (!) API function from my program, and - wo-hooo! - the linker did as told. ONLY the constructor of the OBJECT (C++-API of berkeley) seems not to work. I didnt try whether the complete C API is present and working, I just tried to call a function and to compile, but this seems very strange. I'm sorry if I'm writing too much, but this did cost me the better half of this afternoon, and I don't understand it. But - and I checked that again - all the C++ functions *seem* to be present in the library ... . Again: any ideas? :-)) last time thanks and greetings, axel. p.s.: if I should solve this (not likely) I will post the solution, too ;-) |
|
From: <gen...@ya...> - 2004-04-21 09:40:26
|
axel, there's comething called 'name mangling' that a c++ compiler does to c++ functions. you can't use a c++ function call compiled in VC++ from dev-c++, because the compilers use different name-mangling. regards --------------------------------- Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now |
|
From: Axel B. <new...@th...> - 2004-04-21 12:51:21
|
Oladipo Odumosu wrote: > axel, there's comething called 'name mangling' that a c++ compiler does > to c++ functions. you can't use a c++ function call compiled in VC++ > from dev-c++, because the compilers use different name-mangling. wow. thank you - thats a hint at least .... . google is failing on this matter ;-) I figured something like this by myself in the meantime, but I had no clue - it was basically just a thought, and this gives some substance to it. BUT - du you have a solution? can you switch the name mangling from vc++ to the dev-c++ model? is it *somehow* possible that this will ever work? can you convert the dll/lib/whatever, can you tell dev-c++ how to do it? thanks again, axel. |
|
From: <or...@vp...> - 2004-04-21 22:44:57
|
Axel Bock wrote: > BUT - du you have a solution? can you switch the name mangling from vc+= + > to the dev-c++ model? is it *somehow* possible that this will ever work= ? > can you convert the dll/lib/whatever, can you tell dev-c++ how to do i= t? No, sadly that will never be possible in the foreseeable future. To complicate things even more, GCC itself changes it's own name=20 mangling-scheme from time-to-time. That means for example, C++ libraries=20 (not just DLLs, but static ones also) that are compiled with GCC 3.2.3=20 cannot be used with GCC 3.3.3, because of the name mangling changed=20 between these versions too. I just added this as a side note, because it caused quite a lot of=20 headache for me until I figured this out... :) -- Greetings, Bal=E1zs |
|
From: Axel B. <th...@th...> - 2004-04-22 08:17:30
|
OROSZI Balázs wrote: > No, sadly that will never be possible in the foreseeable future. > > To complicate things even more, GCC itself changes it's own name > mangling-scheme from time-to-time. That means for example, C++ libraries > (not just DLLs, but static ones also) that are compiled with GCC 3.2.3 > cannot be used with GCC 3.3.3, because of the name mangling changed > between these versions too. > I just added this as a side note, because it caused quite a lot of > headache for me until I figured this out... :) oh yeah, thanks, this fact is just sooooooo well documented. if I had known this I hadnt even tried ... . does anyone actually mention this in its documentation or is this just a fact "one knows"?? :-) one wonders whether this should be standardized so that ALL libs from ALL compilers could be used together. well. but anyhow - i managed to re-compile berkeley db with dev-c++, using the "import msvc project" function (GREEAAAAATTT!!!! - I did not realize I had such a thing until it bit me ;-) and modifying some #defines. now it should work just fine :-)) thanks and greetings, axel. |
|
From: Per W. <pw...@ia...> - 2004-04-22 08:53:14
|
One reason why gcc has changed is name-mangling is that gcc have also changed it's internal representation of objects and virtual method tables. It is - of course - only possible to link c++ code from two different compilers if calling conventions and memory layout of objects etc are identical betwen the two compilers. Any little difference would just result in a failing program. Sometimes just generating the wrong answer but most probably exploding because of a pointer error or similar. So the real problem isn't name mangling - which would be possible to solve by C stub functions or some playing around with compiler switches - but that the compilers must use a common ABI. See http://gcc.gnu.org/gcc-3.2/c++-abi.html for some more information. /Per W On Thu, 22 Apr 2004, OROSZI Bal=E1zs wrote: > Axel Bock wrote: > > BUT - du you have a solution? can you switch the name mangling from vc+= + > > to the dev-c++ model? is it *somehow* possible that this will ever work= ? > > can you convert the dll/lib/whatever, can you tell dev-c++ how to do i= t? > > No, sadly that will never be possible in the foreseeable future. > > To complicate things even more, GCC itself changes it's own name > mangling-scheme from time-to-time. That means for example, C++ libraries > (not just DLLs, but static ones also) that are compiled with GCC 3.2.3 > cannot be used with GCC 3.3.3, because of the name mangling changed > between these versions too. > I just added this as a side note, because it caused quite a lot of > headache for me until I figured this out... :) > > -- > Greetings, > Bal=E1zs > > > ---- |