Calling a function by hand
From: William Egge (remove_pro_remove_at_eggcentric.com)
Date: 12/08/04
- Previous message: John O'Harrow: "Re: Fastcode Status"
- Next in thread: Avatar Zondertau: "Re: Calling a function by hand"
- Reply: Avatar Zondertau: "Re: Calling a function by hand"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 8 Dec 2004 11:39:13 -0500
Hello,
I wanted to get some advice before starting a little project.
I need to call a function at runtime but the number of arguments and their
types, and the pointer to the function are not known until runtime.
So, I need to call a function and pass the parameters "by hand" rather than the
compiler doing it at compile time.
I was going to create a procedure that accepts the function pointer and a
variant open array, like the function Format('', []) does. Then I was going to
call the function and pass the parameters.
I know there are different calling conventions, stdcall, cdecl, etc... I assume
that I will be able to call the function correctly if I know its calling
convention and its parameters. The variant array will tell me what the parameter
types are.
The end resulting procedure I imagine is
procedure CallFunction(AFunction: Pointer; Args: array of const);
I want this to be able to call functions in C, C++, and Delphi. I may also want
to call an object method in Delphi or C++.
The possibility of getting return results, and var params might be necessary.
What advice can you give me?
William Egge
http://www.eggcentric.com
- Previous message: John O'Harrow: "Re: Fastcode Status"
- Next in thread: Avatar Zondertau: "Re: Calling a function by hand"
- Reply: Avatar Zondertau: "Re: Calling a function by hand"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|