On 29 Jan 2007, [EMAIL PROTECTED] wrote: > I've tried one new thing, with interesting results, the use of a "- > flat_namespace" flag for the compiler (actually it gets passed to > the linker, I suppose.) The problems that occurred with that are > noted further down. First, though, I thought I might share a few > snippets of things that stood out in the documents I read.
> ---------------------- >> "Important: Mac OS X does not support the concept of weak linking >> as it is found in systems like Linux. If you override one symbol, >> you must override all of the symbols in that object file." > (from <http://developer.apple.com/documentation/Porting/Conceptual/ > PortingUnix/compiling/chapter_4_section_9.html>) > ---------------------- >> "Important: All runtime loaded should be opened into the local >> scope. Adhering to this rule makes finding symbols at runtime as >> fast as possible." >> "Note: Name conflicts between dynamic shared libraries are not >> discovered at compile time, link time, or runtime. The dlsym >> function uses string matching to find symbols. If two libraries use >> the same name for a function, the first one that matches the symbol >> name given to dlsym is returned." Opps, I think I understand your problem now. It is cyclic dependancies (or at least link dependancies). I think that some libraries might contain "weak" references, etc. I had many problems with this in AIX and some embedded systems I worked with. You have to order all libraries in a DAG structure. "http://en.wikipedia.org/wiki/Directed_acyclic_graph" If the libraries contain cycles, then you won't be able to link. I think that the link order will also be important. Say you have libraries like the Wikipedia graph. You have to link 7,5,3 then 11,8 and finally 2,9,10. In order to remove cyclic references, it the code might need to change. For instance, Lib 1 -------- extern int lib2_find_name(char *name); /* in lib 2 */ lib1_lookup_value(char *name) { int lval; while(lval = lib2_find_name(name) != 0); return lval; } lib1_normalize_name(char *name) { char *p = name; while(*p != 0) { if(isupper(*p)) *p = tolower(*p); p++; } } Lib 2 -------- extern lib1_normalize_name(char *name); /* in lib 1 */ int lib2_find_name(char *name) { int lval; char *p = strdup (name); lib1_normalize_name(p) lval =table_lookup(p); free(p); return lval; } It would seem you can just move the "lib1_normalize_name()" to the lib2. You can in this contrived example, but it is not always possible. A solution is to provide a "register_interface" function that takes a structure of function pointers in one library. The "Dominant library/higher level library" will call this function in the lower level library. The lower level library has to call all higher level functions through the pointers. This is slightly less efficient and a PITA. Weak references allow a "dummy" function to be put in lib 2. This will allow linking without lib 1, but with reduced functionality. Are there circular references are in the GTK/Glib libraries or in any of the GTKG libraries? If not, it is probably just the order that libraries are linked. You need to put the "higher layer" libraries first on the link line. Hopefully the "dlsym" will pick the lower levels first. Sorry, I don't have a MAC to play with. Regards, Bill Pringlemeir. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Gtk-gnutella-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel
