dlopen: load dylib from memory rather then file.

Questions and Answers about all things *OS (macOS, iOS, tvOS, watchOS)

dlopen: load dylib from memory rather then file.

Postby adam81 » Wed Jun 07, 2017 10:28 am

Hi,

I'd like to practice loading dylib to my executable, which already reside in memory rather then in file.
I'm using LC_SYMTAB and LC_LINKEDIT to locate the symbols and call them successfully, unless they contain lazy symbols (like printf).

To overcome this, I'd like to avoid dirty symbols when compiling the dylib (that will be copied to memory later on..).
I got some ideas after reading this article http://newosxbook.com/articles/DYLD.html.
so I've tried to compile the dylib using
Code: Select all
-bind_at_load
flag but the lazy symbols remained.

Is there any way to get rid of all symbols that requires additional work for resolving, after the library was mmap'ed ? or any other way to approach this issue (like try and resolve the symbols myself using dyld hidden API)

thanks,
Adam
adam81
 
Posts: 18
Joined: Mon Jan 25, 2016 9:26 am

Return to Questions and Answers

Who is online

Users browsing this forum: No registered users and 1 guest