Re: opening a shared object / failing with Undefined Symbol.

2011-03-29 Thread Jim
On Sat, Mar 26, 2011 at 11:31 PM, Giorgos Keramidas
 wrote:
> On Tue, Mar 22, 2011 at 2:28 PM, Jim  wrote:
>> I have an application that opens two .so files with dlopen(3):
>>  /usr/local/lib/libag_core.so
>>  /usr/local/lib/libag_gui.so
>>
>> Both files exist
>> Running nm(1) against each produces a lot of output, showing all the
>> symbols I know to exist in each library.
>>
>> My application gets a null return from dlopen on the libag_gui.so.
>>
>> dlerror produces the following string:
>>  "/usr/local/lib/libag_gui.so Undefined symbol "agTimingLock"
>>
>> $ nm /usr/local/lib/libag_gui.so | grep agTiming
>>                 U agTimingLock
>>
>> I'm guessing that means that agTimingLock is used in that library but
>> not defined?
>>
>> $ nm /usr/local/lib/libag_core.so | grep agTiming
>> 00141c00 B agTimingLock
>>
>> And this would mean that it is defined in libag_core.so?
>
> Yes, but it's in the uninitialized data section:
>
> % man nm
> ...
>           "B"
>           "b" The symbol is in the uninitialized data section (known as BSS).
>
> What is the "ag" library? Which version are you using? What sort of
> dlopen() call did you try to run?
>

The "ag" library is libagar ( http://libagar.org/ ):

The code amounts to the following:
void * coredl = dlopen("/usr/local/lib/libag_core.so", 0)
void * guidl = dlopen("/usr/local/lib/libag_gui.so", 0)

and the function:
int (*AG_InitCore)(const char * title, int flags);
int (*AG_InitGraphics)(const char * drv);

*((void *)AG_InitCore) = dlsym(coredl, "AG_InitCore");
*((void *)AG_InitGraphics) = dlsym(guidl, "AG_InitGraphics");


The prototypes for the AG_* functions match.


Thanks,
-Jim Stapleton
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: opening a shared object / failing with Undefined Symbol.

2011-03-26 Thread Giorgos Keramidas
On Tue, Mar 22, 2011 at 2:28 PM, Jim  wrote:
> I have an application that opens two .so files with dlopen(3):
>  /usr/local/lib/libag_core.so
>  /usr/local/lib/libag_gui.so
>
> Both files exist
> Running nm(1) against each produces a lot of output, showing all the
> symbols I know to exist in each library.
>
> My application gets a null return from dlopen on the libag_gui.so.
>
> dlerror produces the following string:
>  "/usr/local/lib/libag_gui.so Undefined symbol "agTimingLock"
>
> $ nm /usr/local/lib/libag_gui.so | grep agTiming
>                 U agTimingLock
>
> I'm guessing that means that agTimingLock is used in that library but
> not defined?
>
> $ nm /usr/local/lib/libag_core.so | grep agTiming
> 00141c00 B agTimingLock
>
> And this would mean that it is defined in libag_core.so?

Yes, but it's in the uninitialized data section:

% man nm
...
   "B"
   "b" The symbol is in the uninitialized data section (known as BSS).

What is the "ag" library? Which version are you using? What sort of
dlopen() call did you try to run?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


opening a shared object / failing with Undefined Symbol.

2011-03-22 Thread Jim
I have an application that opens two .so files with dlopen(3):
  /usr/local/lib/libag_core.so
  /usr/local/lib/libag_gui.so

Both files exist
Running nm(1) against each produces a lot of output, showing all the
symbols I know to exist in each library.

My application gets a null return from dlopen on the libag_gui.so.

dlerror produces the following string:
  "/usr/local/lib/libag_gui.so Undefined symbol "agTimingLock"

$ nm /usr/local/lib/libag_gui.so | grep agTiming
 U agTimingLock

I'm guessing that means that agTimingLock is used in that library but
not defined?

$ nm /usr/local/lib/libag_core.so | grep agTiming
00141c00 B agTimingLock

And this would mean that it is defined in libag_core.so?

Given that libag_core.so gets loaded first, does anyone have any
suggestions on how to fix such an issue? (Note: I didn't write this
library, I did compile/install it)

Thanks,
-Jim Stapleton
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"