This is the mail archive of the ecos-discuss@sourceware.org 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 loader and object loader


Hi,

I'm working, on ecos, for web service test (DPWS).

I'd like to use dynamic loader on i386 PC target and ARM target, the readme
says that should be not working (services\loader) on this target.
Is it possible to use objloader for dynamic loader (on i386 PC target and
ARM target)??

A simple program on linux OS:

#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
int i;
int exeCall(char c)
{
??? i = -1;
??? printf("EXE >> Setting? i = -1, stopping the loop\n");??? 
??? return 42;
}
int main(int argc, char **argv)
{
?????? void (*init)(void *fptr);
??? ???int j = 0;????? 
?????? void *hndl = dlopen("./libdyn.so", RTLD_NOW);
?????? if(hndl == NULL)
?????? {
???????????? printf("erreur dlopen : %s\n", dlerror());
???????????? exit(-1);
?????? }?
?????? init = (void(*)()) dlsym(hndl, "init");
?????? if (init == NULL)
?????? {
???????????? printf("erreur dlsym : %s\n", dlerror());
???????????? exit(-1);
?????? }
?????? init(exeCall);
?????? printf("EXE >> Start counting !\n");
??? while ( i != -1)
??? {
??????? printf("EXE >> Counting J => %d !\n",j);
??????? j++;
??????? sleep(1);
??? }?? 
?????? dlclose(hndl);
?????? return EXIT_SUCCESS;
}

With a dynamic library:

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
int (* switchProc)(char) = NULL;
void *my_thread_process (void * arg)
{
? int i;
? for (i = 0 ; i < 5 ; i++) {
??? printf ("DLL >> Thread %s: %d\n", (char*)arg, i);
??? sleep(1);
? }
??printf("DLL >> MyThread is Awekening, calling EXE\n");
??switchProc('P'); 
? pthread_exit (0);
}
void init(void * fptr)
{
?? pthread_t th1;
?? void *ret;
?? if (pthread_create (&th1, NULL, my_thread_process, "1") < 0) {
???? fprintf (stderr, "pthread_create error for thread 1\n");
???? exit (1);
?? }
?? printf("DLL >> dll init \n");
?? switchProc = fptr;?? ?
}

How do I run that test on eCos OS? Is it possible??
Does anyone have documentation on the dynamic loader or the object loader?

Regards.
------------------------------
David MIRAS 
Sogeti High Tech
email: david.miras@sogeti.com


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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