Scott Watson (scott++at++disney.com)
Sat, 3 Feb 1996 13:19:38 -0800
...
Dwight> Pointers on how I can create classes with virtual methods
Dwight> that I can pfMalloc into the shared arena would be greatly
Dwight> appreciated.
I'm not sure it addresses your problem but we use virtual functions
of objects allocated in shared arenas and use them in multiple
processes and it works ok.
We override new like:
void * operator new (size_t n) {
void * p;
if(!arena_inited) dvInitArena();
if(! n) n++; // catch people who alloc 0 len
if(arena){ // support running w/o a shared arena
p = usmalloc(n, arena);
} else {
p = malloc(n);
}
if (!p) { // Be informative about failure to allocate
report_mem_err();
}
return p;
}
Since most of our system is loaded as .so we also have the following
in our link/compile lines.
-Wl,-update_registry,/usr/local/lib/so_locations
which has the effect of putting the text of your program at the
same address even when your not forked from the same parent.
-Scott
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:21 PDT