I hope this isn't a stupid easy question, but I am planning to load a ram disk and some custom libraries for HAL, Keyboard, Video...etc. I will have standard interfaces for these "drivers" and I really just want to know how I make use of the functions in the files. before my kernel loads I am going to load the files in a RAMDisk I have functions to read and write to the RAMDisk but I don't know how to make use of the information inside it.
It might be as easy as declareing a function external and prototypeing it somewhere in my code but then how do I redirect the execution to the actual function when I need it?
Thank you for any answers and I will elaborate if need be. just let me know what information is lacking.
How do I call a function in an external file???
How do I call a function in an external file???
Getting back in the game.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: How do I call a function in an external file???
Since it's already in RAM, it's just a matter of CALLing your library functions. All you need is their entry points.
EDIT: seems berkus beat me to it
EDIT: seems berkus beat me to it
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: How do I call a function in an external file???
Berkus, is there a tutorial or sample code that explains that plugin abstraction process in detail? That sounds like the ticket, I just need to see how to properly implement it.
Getting back in the game.
-
- Member
- Posts: 524
- Joined: Sun Nov 09, 2008 2:55 am
- Location: Pennsylvania, USA
Re: How do I call a function in an external file???
If you are using ELF files you may want to implement a dlsym() like function that will take a symbol name (as a string) and return it's address. It is slightly more flexible (since it doesn't require a special entry function) but not strictly necessary.
Re: How do I call a function in an external file???
okay, sorry for the long wait. I don't have internet right now. I live in Ky where the ice storms hit. I found a bunch of dlsym code examples and looked at that qtplugin that berkus mentioned. I like the idea but this is a linux type implementation isn't it. is there a straighht forward non GPL way of doing this. do I simply load the file and search through the file for the string output by the linker to signify the funciton? I could use a dlsym type implementation that way, I would just need to read up on how the MSVC linker outputs the function names. I have that information somewhere. let me know if I am on the right track. I could use the function pointer method that dlsym and my idt use.
Thanks for the help already recieved and any more given.
Thanks for the help already recieved and any more given.
Getting back in the game.
-
- Member
- Posts: 524
- Joined: Sun Nov 09, 2008 2:55 am
- Location: Pennsylvania, USA
Re: How do I call a function in an external file???
If you're compiling with MSVC, then its a PE file. The PE specs will show you how to find the exported symbol table.