Click here to Skip to main content
14,177,166 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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'
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Use COM and you have to export only one function like <code>DllGetClassObject</code> to connect to all your interfaces.
   
  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190526.1 | Last Updated 29 Dec 2010
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100