How to access linux symbols from dynamically loaded .so (dlopen)
From: Nishant Galange <hidden>
Date: 2005-09-14 12:28:12
Hi all
Help needed desperately. Some background on the problem:
The embedded linux (built as one large elf
file) contains an important function called "board_init()"
A test module (built as a shared object test.so) contains a function
called start_test()
void start_test() {
=09board_init(); /* The shared object has to call a function defined in the=
embedded linux elf image */
=09/*Do board tests here... */
}
1. Linux comes up to the command prompt on the board.
2. A GUI application communicates with the board via Ethernet=20
3. The GUI
transfers the test module test.so over Ethernet=20
4. The downloaded test.so is loaded via dlopen().=20
5. dlopen() and dlsym() calls succeed. start_test() starts executing=20
6. It barfs at board_init() saying "Undefined symbol: board_init"
So the dynamically loaded shared object cannot get a reference to a functio=
n define in the linux that loaded it...
How do we solve this problem? How do I make sure that symbols in the linux =
image are exposed to dynamically loaded libraries?
Most probably, it has a simple solution to tweak some compiler/linker
options. But I may be wrong...
Waiting,
Nishant