The code for the first module is:
-----------------
#include<rtl_time.h>
#include<rtl.h>
#include <pthread.h>
#include "test1.h"    //header file where the function
test() is defined.

pthread_t mytask;

void *onoff(void *t)
{  
  while (1)
  {
        test();  // call upon the function in the second
module
        pthread_wait_np();
  }
}
int init_module(void)
{
   int s_create;
   hrtime_t now=gethrtime();

   s_create=pthread_create(&mytask, NULL,onoff,(void*)
0);
   if (s_create)
   {            rtl_printf("Failed to create a     thread\n\t
cause: %d\n",s_create);
        return s_create;        }
         
pthread_make_periodic_np(mytask,now+2*NSECS_PER_SEC,NSECS_PER_SEC);
return 0;       
}

void cleanup_module(void)
{       pthread_delete_np(mytask);}

------------------

and the code for the second module:

---------
#include<rtl.h>

void test(void)
{ 
  static int i=0;
  while (1)
  {     rtl_printf("%d ",i);
        i++;
  }
}
----------

I was expecting the second module(test()) to be called
from the first module every second (NSECS_PER_SEC). It
does nothing but printing on the screen a number. No
need to say that this is only a test program.
Both files are compiled by using make (rtl.mk). I can
load the first model although it obviously does
nothing. however when I try to load the second module
the computer crashes.
I also compiled both files into a single object file
and tried to load it. But I get the following errors

unresolved symbol main
unresolved symbol rtl_printf
unresolved symbol gethrtime
... and some more.

I hope this makes things clearer.

thanks
Kanta





--- Karim Yaghmour <[EMAIL PROTECTED]> wrote: > 
> What you are asking for is very feasible. Actually,
> this is how both
> RTLinux and RTAI provide their services. That said,
> the information
> you provide is insufficient if one wants to give an
> adequate diagnosis.
> 
> Could you show some code ... ?
> 
> Kanta wrote:
> > 
> > Hi there
> > is it possible at all to load two different
> modules
> > and call functions of module1.o from module2.o.
> That
> > is, module1 only has functions that are to be used
> in
> > module2 but not the init_module and cleanup_module
> > functions, which are defined in module2. I have
> tried
> > to do this: I loaded module1 without problems but
> on
> > loading module2 the computer crashed.
> > 
> > thanks
> > Kanta
> > 
> >
>
____________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.co.uk address at
> http://mail.yahoo.co.uk
> > or your free @yahoo.ie address at
> http://mail.yahoo.ie
> > -- [rtl] ---
> > To unsubscribe:
> > echo "unsubscribe rtl" | mail
> [EMAIL PROTECTED] OR
> > echo "unsubscribe rtl <Your_email>" | mail
> [EMAIL PROTECTED]
> > ---
> > For more information on Real-Time Linux see:
> > http://www.rtlinux.org/rtlinux/
> 
> -- 
> ===================================================
>                  Karim Yaghmour
>                [EMAIL PROTECTED]
>           Operating System Consultant
>  (Linux kernel, real-time and distributed systems)
> ===================================================
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED]
> OR
> echo "unsubscribe rtl <Your_email>" | mail
> [EMAIL PROTECTED]
> ---
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/
> 




____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to