develooper Front page | perl.perl6.internals | Postings from September 2005

loadlib and libraries with '.' in the name

Thread Next
Ross McFarland
September 22, 2005 22:52
loadlib and libraries with '.' in the name
Message ID:

i was playing around with NCI stuff tonight and ran across a problem  
in loadlib. the following code does not work:

     .local pmc lib_gtk
     lib_gtk = loadlib "libgtk-x11-2.0"

the problem is the '.' in the library name. code was added to src/ 
dynext.c in 8209 that gets the lib_name, the name of the library  
without any prefix or leading path information. this fix breaks the  
ability to load libraries with .'s. the offending code is:

     ext_start = strrchr(*lib_name, '.');
     if (ext_start)
         *ext_start = '\0';

which finds the last '.' in the library name and sets it to the null  
char if one is found, thus turning libgtk-x11-2.0 in to libgtk-x11-2  
which can't be found. this results in an unable to load libgtk- 
x11-2.0 with an "unknown reason" message.

if i set ext_start to NULL just before the test and null char set and  
the library loads fine.

i'm not really sure what the solution here would be. you'd have to  
know what all of the possible extension types were and look to remove  
them if found otherwise you have no idea what is and isn't just part  
of a library name. in what situation would you be passing in a full  
path and file with extension to loadlib? is that a requirement to be  
able to? it sound unnecessary to me. i'm willing to implement and  
test any ideas/suggestions people have.

i was planning on playing around with gtk+ bindings and parrot and  
went about looking around for the work that had already been done and  
didn't turn anything up. if anyone knows where i can find it or who i  
should talk to i would appreciate that info as well.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About