Dlopen / dlsym with as little linking as possible?

If you are using elf binaries you may want to see if your platform has libelf available. Try man elf for more info. This may get you what you need without having to actually link.

I have never used it though, so I don't know.

Thanks, based on an example from Solaris' gelf(3ELF) man page I created a small tool which, on the fly, generates a . So with all needed symbols, then loads this . So and then dlopen()'s my plugin.

A bit hackish but works :-) (probably I might have done that with a shell script paring ldd output, too ... but works for now and I can organize my plugins here) – johannes Apr 16 '10 at 15:28 Well, you're probably smarter than me to have made that tool. Very interesting. Glad I could be of assistance.

– nategoose Apr 20 '10 at 23:25.

According to man dlopen (emphasis is mine) RTLD_LAZY Perform lazy binding. Only resolve symbols as the code that references them is executed. If the symbol is never referenced, then it is never resolved.(Lazy binding is only performed for function references; references to variables are always immediately bound when the library is loaded.) So you need to add to your tool all the global variables your plugin might use.

Yeah, I hoped somebody would have an idea for a work-around :-/ – johannes Apr 10 '10 at 18:51.

How about a dirty hack with objdump: ~$ objdump -s -j . Rodata plugin. So plugin.So: file format elf32-i386 Contents of section .

Rodata: 20000000 73616d70 6c652070 6c756769 6e00332e sample plugin.3. 20000010 322e3100 312e322e 3300 2.1.1.2.3.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions