Another fix for libltdl

Raffaele Sena raff at aromatic.com
Tue Jan 12 01:07:50 PST 1999


I found another problem with libltdl while trying to use .so libraries
instead of those "strange" .la (before I figured out how .la worked).

ltdl.c contains some code to cope with "standard" shared libraries
(non-libtool), but it's not complete. Basically the handle->name field
is set to NULL for non-libtool objects, but then it's always expected
to be valid, because it's used as parameter to string functions (that,
in many implementations, crash if the source string is NULL).

Here are some changes to stop the crash to happen. Now it seems I can
load .so kaffe libraries, but still I cannot load my own native code
as a .so :(

-- Raffaele

Index: ltdl.c
===================================================================
RCS file: /home/cvspublic/kaffe/libltdl/ltdl.c,v
retrieving revision 1.2
diff -r1.2 ltdl.c
978c978,979
< 	int lensym = strlen(symbol), lenhand = strlen(handle->name);
---
> 	int lensym = strlen(symbol);
> 	int lenhand = handle->name ? strlen(handle->name) : 0;
988a990,991
> 
> 	if (handle->name) {
990,993c993,996
< 	/* this is a libtool module */
< 	/* prefix symbol with leading underscore */
< 	strcpy(sym, "_");
< 	strcat(sym, handle->name);
---
> 		/* this is a libtool module */
> 		/* prefix symbol with leading underscore */
> 		strcpy(sym, "_");
> 		strcat(sym, handle->name);
995,996c998,999
< 	/* this is a libtool module */
< 	strcpy(sym, handle->name);
---
> 		/* this is a libtool module */
> 		strcpy(sym, handle->name);
997a1001,1003
> 	} else
> 		*sym = '\0';
> 

-------------------------------------------------------------------------
raff at aromatic.com           (::)           http://www.aromatic.com/~raff/
                  http://www.aromatic.com/



More information about the kaffe mailing list