Re: Modules - Global Data



Michael A Clark <macst92+ pitt edu> writes:
Is it ok to use/modify global data objects from a function that was loaded
from a module (g_module_symbol). The functions that I load from modules
modify a few global data objects and seem to work alright themselves. But
now other functions of my program are dumping core all over the place. Is
there some simple example i could look at.. I haven't been able to make a
whole lot of sense of the code that i have looked at so far.


It depends on what you mean by "global data object" and where the
object is located. But in general you should be able to use symbols
defined in the process you get loaded into. Note that you had better
use the right headers, if you have "extern int foo;" when building the
module but the process you load into really defines "double foo;" you
will get segfaults all over the place.

You might want to look at the man page for dlopen() which is how
GModule is implemented on Linux.

Havoc





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]