Help!

Loading object files at runtime

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> App Development RSS
Next:  [PATCH] drivers/s390: put NULL test before derefe..  
Author Message
fft1976
External


Since: Jul 28, 2009
Posts: 1



PostPosted: Tue Jul 28, 2009 11:01 am    Post subject: Loading object files at runtime
Archived from groups: comp>os>linux>development>apps, others (more info?)

Is there a library that allows loading object files (not shared
libraries) at runtime?

I'd like to load an object file that gets compiled after the process
starts and to call a function in it whose name and type are known in
advance.

I wonder if such functionality exists under Linux or Windows (32 or 64
bit).

Thanks
Back to top
Joe Pfeiffer
External


Since: Dec 21, 2004
Posts: 94



PostPosted: Tue Jul 28, 2009 12:49 pm    Post subject: Re: Loading object files at runtime [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

fft1976 <fft1976 RemoveThis @gmail.com> writes:

> Is there a library that allows loading object files (not shared
> libraries) at runtime?
>
> I'd like to load an object file that gets compiled after the process
> starts and to call a function in it whose name and type are known in
> advance.
>
> I wonder if such functionality exists under Linux or Windows (32 or 64
> bit).

dlopen() and friends would do it, except for your insistence that it not
be a .so file. Why not?
--
Klingon programs don't have parameters. They have arguments and win
them (Walter Bushell)
Back to top
Loïc_Domaigné
External


Since: Jul 28, 2009
Posts: 4



PostPosted: Tue Jul 28, 2009 9:48 pm    Post subject: Re: Loading object files at runtime [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Good Morning,

> Is there a library that allows loading object files (not shared
> libraries) at runtime?
>
> I'd like to load an object file that gets compiled after the process
> starts and to call a function in it whose name and type are known in
> advance.
>
> I wonder if such functionality exists under Linux or Windows (32 or 64
> bit).

This is possible. However, you need to be able to resolve the symbol
addresses contained in the object at runtime (runtime binding). This
implies necessary using shared object. See for instance:
http://www.ibm.com/developerworks/linux/library/l-dynamic-libraries/index.html

HTH,
Loïc
--
My blog: http://www.domaigne.com/blog

“The best thing about a boolean is even if you are wrong, you are only
off by a bit.”
Back to top
David Schwartz
External


Since: Apr 29, 2007
Posts: 57



PostPosted: Tue Jul 28, 2009 10:05 pm    Post subject: Re: Loading object files at runtime [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jul 28, 11:01 am, fft1976 <fft1... DeleteThis @gmail.com> wrote:

> Is there a library that allows loading object files (not shared
> libraries) at runtime?
>
> I'd like to load an object file that gets compiled after the process
> starts and to call a function in it whose name and type are known in
> advance.
>
> I wonder if such functionality exists under Linux or Windows (32 or 64
> bit).
>
> Thanks

On Linux, 'gcc -shared' can provide this functionality.

DS
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> App Development All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum