I need to know the feasibility of "mmaping" a virtualmemory and loading binary code into it and execute the binary code. The binary code (presented as shared library) may be mach format or elf format, which will be loaded into the memory through file-mapping way by our binary loade other than the apple's own unix binary loader.
Has someone tried it before? If you have any clue about that pls tell me, and we can discuss it more. 开发者_StackOverflow中文版 By the way, does anyone know how to upload a shared library (not linked by app) to iphone simulator or device with iphone app developed together?
You can use mmap()
on the iPhone. The iOS SDK agreement is generally against dynamic code loading, so you will probably not be allowed to use it to provide code that was not available when the app was shipped. You will want to talk to Apple about that, but I feel quite confident in predicting that what you want to do won't be permitted.
Consider whether your reason for supplying your own code loader is genuine, or whether you can actually get away with using the iOS dyld
.
精彩评论