Click here to Skip to main content
16,016,759 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: dynamically calling dll functions Pin
Ryan Binns30-May-05 22:46
Ryan Binns30-May-05 22:46 
GeneralRe: dynamically calling dll functions Pin
Tom Archer31-May-05 2:52
Tom Archer31-May-05 2:52 
GeneralRe: dynamically calling dll functions Pin
Ryan Binns31-May-05 3:21
Ryan Binns31-May-05 3:21 
GeneralRe: dynamically calling dll functions Pin
Ryan Binns31-May-05 4:09
Ryan Binns31-May-05 4:09 
GeneralRe: dynamically calling dll functions Pin
Tom Archer1-Jun-05 1:32
Tom Archer1-Jun-05 1:32 
GeneralRe: dynamically calling dll functions Pin
munawar196831-May-05 18:43
munawar196831-May-05 18:43 
GeneralRe: dynamically calling dll functions Pin
Tom Archer1-Jun-05 1:31
Tom Archer1-Jun-05 1:31 
GeneralRe: dynamically calling dll functions Pin
geo_m31-May-05 20:01
geo_m31-May-05 20:01 
Well, just wild guess and I tried it just today at morning, but under some limitations you can go (probably) this way:

If you can stick with the C call convention (no pascal, at least I think), and you can specify fixed type for return parameter, you can define the function signature as follows:

typedef DWORD (__stdcall *pFunction)(...);

Then you can call it in this way:

int execute()
{
	MyruntimeFunc = (pFunction)GetProcAddress( NULL,"TestFunction");
	MyruntimeFunc( 1 );
	return -1;
}

extern "C"
{
__declspec( dllexport ) DWORD TestFunction( DWORD ard )
{
	int x = 0;
        return 0;
};
}


Because TestFunction knows what to look for on the stack, she'll find it. You only have to make you sure that you'll put the correct types (very important, (BYTE)1 is here not the same as (DWORD)1 ) in correct order.

It's just a morning idea, before I finally wake up, but maybe it will help you. I tested it inside one single .exe file, so maybe some of my assumptions are bad. But at least I tried Wink | ;-)
GeneralExe as child process Pin
Michael Klim30-May-05 10:42
Michael Klim30-May-05 10:42 
GeneralRe: Exe as child process Pin
Ravi Bhavnani30-May-05 15:45
professionalRavi Bhavnani30-May-05 15:45 
GeneralProgram executes automatically Pin
Identity Undisclosed30-May-05 9:27
Identity Undisclosed30-May-05 9:27 
GeneralRe: Program executes automatically Pin
Toni7830-May-05 10:41
Toni7830-May-05 10:41 
GeneralRe: Program executes automatically Pin
Identity Undisclosed30-May-05 10:57
Identity Undisclosed30-May-05 10:57 
GeneralRe: Program executes automatically Pin
Christian Graus30-May-05 14:06
protectorChristian Graus30-May-05 14:06 
GeneralRe: Program executes automatically Pin
Identity Undisclosed31-May-05 2:32
Identity Undisclosed31-May-05 2:32 
GeneralRe: Program executes automatically Pin
Toni7830-May-05 16:18
Toni7830-May-05 16:18 
GeneralRe: Program executes automatically Pin
Toni782-Jun-05 3:46
Toni782-Jun-05 3:46 
GeneralRe: Program executes automatically Pin
Tom Archer30-May-05 14:02
Tom Archer30-May-05 14:02 
GeneralRe: Program executes automatically Pin
Identity Undisclosed31-May-05 2:33
Identity Undisclosed31-May-05 2:33 
GeneralRe: Program executes automatically Pin
Ravi Bhavnani30-May-05 15:47
professionalRavi Bhavnani30-May-05 15:47 
GeneralRe: Program executes automatically Pin
Identity Undisclosed30-May-05 21:40
Identity Undisclosed30-May-05 21:40 
GeneralRe: Program executes automatically Pin
Flit31-May-05 1:41
Flit31-May-05 1:41 
GeneralRe: Program executes automatically Pin
Identity Undisclosed31-May-05 2:29
Identity Undisclosed31-May-05 2:29 
GeneralRe: Program executes automatically Pin
Flit31-May-05 3:24
Flit31-May-05 3:24 
GeneralRe: Program executes automatically Pin
Christian Graus31-May-05 11:10
protectorChristian Graus31-May-05 11:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.