This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dynamic loading on eCos


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]