ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
ive a .so file stored in a (char *) is there any way i could load functions from it directly? without writing it to disk?
it can be done in windows (dll files) by using some c implementation to use LoadLibrary and GetProcAddress on a dll stored in memory (char *), so i was wondering if such thing exists or possible on linux with dlopen and dlsym?
The trick is that there is executable code in the library. The char array is in a data-only space, and code in a data segment is not executable. An interesting question is how a userspace application coerces the appropriate pieces of the shared object library to load into an appropriate code space.
i dont think its related to the executable sections (.text in this case) the whole problem lies on mapping it to memory as .so file (like dlopen does) and obtain its file descriptot, the rest i guess is easy
basically its the ld-linux that hooks up static libraries to running programs. my guess would be that you'd have to take its source and modify it to do what you want.
i dont think its related to the executable sections (.text in this case) the whole problem lies on mapping it to memory as .so file (like dlopen does) and obtain its file descriptot, the rest i guess is easy
Then what do you mean by 'load functions from it'?
It sounds like you are simply trying to replicate the work of a linking loader. Why not have the the existing loader do this? It works on files, though, not on in-memory images. If you export the in-memory image as a virtual file (fuse), then it could be operated on by a conventional loader.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.