This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
dynamic loading on eCos
- From: Dominique Henry de Villeneuve <d dot devilleneuve at ri dot silicomp dot fr>
- To: ecos-discuss at sources dot redhat dot com
- Date: Thu, 24 Jan 2002 18:59:22 +0100
- Subject: [ECOS] dynamic loading on eCos
- Organization: Silicomp Research Institute
Hi,
Is there a special way to build a shared library on eCos?
The simple example below breaks in SIGSEGV when calling the dynamic
function.
If 'my_dl_function' is redefined to be cosinus
(dlsym("/usr/lib/libm.so", "cos"),
it works fine. That's why i guess the problem is on the shared lib...
------------------------------------------------------------
/* this is the main program */
int main()
{
void *handle;
void (*my_dl_function)(void);
handle = dlopen ("dl_lib.so", RTLD_GLOBAL);
my_dl_function = dlsym(handle, "my_function");
(*my_dl_function)();
dlclose(handle);
cyg_hal_sys_exit(1);
}
-----------------------------------------------------------
/* the single file of the shared lib: dl_lib.c
* gcc -c dl_lib.c
* gcc -shared -o dl_lib.so dl_lib.o
*/
void my_function();
void my_function()
{
printf("this is my function\n");
}
-----------------------------------------------------------
I used the ecos version (v1_3_1_x20010912), target (linux), template
(elix).
I've added the rtld package (and adapted it so that it can run on
synthetic).
Thanks to help,
Dominique