DL: Array of symbols in a dynamic lib


#1

With DL, is there a way to ask for the symbols that exist within a
module that I’ve loaded?

For instance, once I’ve done…

module_handle = DL::dlopen('my_lib')

Can I then ask module_handle for an array of symbols? I can’t see a
likely looking method in there, and it seems like it’d be very nice
to have that kind of introspection available.

Off topic, can someone give me a good entry point for OS X’s tool
chain for looking inside dynamic libraries, and understanding the
subject in general? I really found myself struggling! The only really
constructive thing I found out last night was that on OS X, you need
to ask cgg to make you:
-dynamiclib

This let me try an example out (which worked, wooO!), but I’ve no
idea where these things are usually kept (somewhere in bundles?). Or
how I can peek about in one.

Cheers,
Benjohn


#2

On Fri, 26 May 2006, Benjohn B. wrote:

Cheers,
Benjohn

it’s not exactly what you’re asking, but try

strings libname.so

on the command line.

another useful command is

ldd libname.so

also

man ld.so

hth.

-a


#3

On Fri, 26 May 2006, Gregory S. wrote:

} ldd libname.so
}
} also
}
} man ld.so

Actually, /usr/bin/nm is probably a better bet than any of these.

indeed. i’m still drinking my coffee! :wink:

-a


#4

On Fri, May 26, 2006 at 11:24:15PM +0900, removed_email_address@domain.invalid wrote:
[…]
} it’s not exactly what you’re asking, but try
}
} strings libname.so
}
} on the command line.
}
} another useful command is
}
} ldd libname.so
}
} also
}
} man ld.so

Actually, /usr/bin/nm is probably a better bet than any of these.

} hth.
} -a
–Greg


#5

On 26 May 2006, at 15:53, removed_email_address@domain.invalid wrote:

}
indeed. i’m still drinking my coffee! :wink:
Brilliant :slight_smile: Thanks Ara and Greg - they look good.


#6

On 26 May 2006, at 23:59, Benjohn B. wrote:

} strings libname.so

Actually, /usr/bin/nm is probably a better bet than any of these.

indeed. i’m still drinking my coffee! :wink:

Brilliant :slight_smile: Thanks Ara and Greg - they look good.

Interesting that objective c methods are verbosely described in a
symbol table. From the man pages of nm:

If the symbol is a Objective C method, the symbol
name is
±[Class_name(category_name) method:name:], where +' is for class methods,-’ is for instance methods, and (category_name)
is present
only when the method is in a category.

I don’t remember if objective c method signatures are typed though,
or if all of the parameters must be object ids? If the later’s the
case, then you’ve got just about everything you need in the symbol
table and the header isn’t really needed.