On Saturday 03 November 2007, Thomas Sailer wrote: > Now you have three "x" variables, one in the main program and > two in their respective DLL.
Different from the posix standard??? On *ix, a global object is declared once, somewhere, and "extern" everywhere else. > Under windows, access to a variable in the main program and > access to a global variable in a DLL is done by different > code sequences, see below. Given these differences, it's easy > to see why the DLL "x" cannot just replace the main program > "x". > > But why do you do the - IMO ugly - global variable trick? The code I posted is a short test program to illustrate the issue, not cluttering it with anything not relevant to this discussion. I would not release production code like this. The real issue is the global function bar(). > Why > can't you just use dlsym / GetProcAddress to get the address > of y? I thought of that ... > Or a factory static function, that allocates the > respective object and returns its address? The actual gnucap code is a factory static object that allocates the respective object and registers it with a dispatcher, so it can be accessed by name (a string). The dispatcher itself is global. _______________________________________________ geda-dev mailing list [email protected] http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev
