Subject Re: [firebird-support] udf and iostream problem
Author Aurimas Černius
Hi,

>>> I tried ldd before and after the "include<iostream>"
>>> the result is the same:
>>> linux-gate.so.1 => (0xb7f12000)
>>> libc.so.6 => /lib/libc.so.6 (0xb7dd9000)
>>> libm.so.6 => /lib/libm.so.6 (0xb7db3000)
>>> /lib/ld-linux.so.2 (0xb7f13000)
>>
>> I think there should be libstdc++ here as well. That might be the case.
>>
>>> I simplified the code, now it is:
>>>
>>> include<iostream>
>>>
>>> char* edb_getComputerName(){
>>> return 0;
>>> }
>>>
>>> and the generated library ca not be loaded in firebird.
>>> If I build it as an application - it works normally !!!
>>
>> What does ldd say for that application?
>>
>>> I tried to run firebird service as root - jut to check, but the library
>>> still can not be loaded.
>>
>> There shouldn't be any difference between root and non-root.
>>
> Obviously I am missing something. Here are the commands I use to compile
> and link:
> gcc -Wall -fpic -c -o./miscfuncs.o ./miscfuncs.cpp
> ld -G ./miscfuncs.o -Bsymbolic -lc -lm -o ./edbutil.so
>
> the result is missing dependency to libstd++
>
> If I make a program instead of library and compile with g++ - everything
> is OK.
> So the question is: How to compile and link my library? It is a couple
> of files in different directories.


I think you can link a library with g++ (just use g++ instead of ld).
Only pass linker arguments properly.
Also, there is an option -fno-undefined or similar, that will cause link
failure, if there is something missing. You can also add libstdc++ to
command line with -lstdc++.

--
Aurimas