Symbols relocatable using dlopen?
Marcus Clyne
bu.eugaia@gmail.com
Fri Aug 28 12:44:00 GMT 2009
Hi Alan,
Thanks for your reply.
Alan Modra wrote:
> On Fri, Aug 28, 2009 at 12:58:06PM +0300, Marcus Clyne wrote:
>
>> I have a function my_print () defined in my program, but in calling
>> dlopen() I get the following error:
>>
>> undefined symbol: my_print
>>
>
> my_print is likely not a dynamic symbol. You can check with nm -D.
> There are a number of ways to make sure it is dynamic, eg. link
> your program against your dlopen'd shared lib with --no-add-needed,
> or use --dynamic-list.
>
>
my_print isn't a dynamic symbol in the program.
Am I right in understanding that you mean that if I make the symbol
dynamic in the main program, then it will be relocatable in the shared
object when it's loaded, but if it's static, then it won't be?
If I understand the --no-add-needed option correctly, it's not
appropriate for my situation as I don't know the names of the libraries
when linking the program file.
I've tried using --dynamic-list=/file/path in the linker options. In
the /file/path I have 'my_print' in it on its own, but am getting
'syntax error in dynamic list' messages. I've also tried 'my_print,'
with no luck.
I've looked in the man pages and online for the syntax for
--dynamic-list files, but haven't found it yet. Do you know what the
format for the dynamic list files is?
Thanks,
Marcus.
More information about the Binutils
mailing list