views:

200

answers:

1

Hello,

I have a shared object which i create on windows using Real View developer suite tool linked command on windows host-

armlink -o mylib.so <"my *.o files given here">

Then i link an application with this mylib.so shared library on linux using gcc tools.

I have printf statements inside functions in this mylib.so, but when I run the final executable, i do not get any printf outputs on console.(stdio.h is inlcuded wherever printfs are called)

So is there any known issue with shared libraries which cause printf or any system functions/system calls/run time library functions not to work correctly?

Or is that got to do with my peculiar setup of making a shared library on windows based compiler tool chain but linking this shared library with an application on linux-gcc compiler tools?

Thank you.

-AD

A: 

Since your target is arm, and I assume this is C it should not be a problem to compile some files on windows and then link on linux. Have you verified this however? I would suggest making a hello.so on windows, linked from hello.c:

#include <stdio.h>
void hello(void) {printf("Hello\n");}

and then link main from main.c on linux:

void hello(void);
int main(int argc, char *argv[]){ hello(); return 0; }

as a minimum compiler chain test.


If you call printf from code in defined in your final executable (i.e. not code from your shared library) do you get any output from that?


Does

strings --print-file-name -a mylib.so final_executable | grep "string from printf in shared library"

return two occurenses?


Are there any references to printf in

readelf -a mylib.so
readelf -a final_executable

?

hlovdal
@hlovdal: The printfs which are in main/application are printed correctly, only the ones inside the shared library are not 'outputting' anything. Also the library creation, and linking to executable is happening correctly i guess.I will check about 'readelf' , 'strings --printf..' outputs.-AD
goldenmean