Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I was wondering if anyone knew of a straight forward way of calling (non-exported) functions in an executable from a DLL. We are building a, for lack of a better name, private plug-in system that will grant the plug-in access to all of a processes internals, without having to export the hundreds of methods and classes we have.

Posted

oohhh .. thats a hard one. Unless your executable exposes some sort of API I think you'd have to resort to using injection/hooking from the dll (which I presume is in another process) to access the functions in the executable, even then ...

Usually as Im sure you're painfully aware, a plugin system involves the executable 'discovering' its plugins, then possibly calling something within the plugin to say 'what do you expose/do', or has a narrowly defined interface, not the other way around ..

If it were me (and Ive been here before, and are about to venture in this space again), I would would have the exe expose its functions through an IPC or TCP/IP interface, presenting commands to a command interpreter built into the exe, but its hard to do that unless you build it from the ground up. My next app is going to have an inbuild mini-webserver in it for both input/output and control ..

Maybe you can research injection/hooking, the microsoft library 'detours' for example to see if that can help ... the danger with these (well, one of the dangers), is that the usage is tightly bound to your internals/classes ...

sorry, good luck

[edit] .. if it were just a matter of exposing global variables for instance, I'd be using a shared memory implementation [/edit]

'g'
 
Share this answer
 
Use COM and you have to export only one function like <code>DllGetClassObject</code> to connect to all your interfaces.
 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900