Original Post
🔒 Locked
address
Advertisement
If you have array defined like
dword someArray[100];
someArray contains the pointer to the first member of array.
for function pointers go to:
www.function-pointer.org
Vikke Matikainen
dword someArray[100];
someArray contains the pointer to the first member of array.
for function pointers go to:
www.function-pointer.org
Vikke Matikainen
typedef int (*FuncType)( long param1, long param2 );
#define FUNCBUILDER( X ) int X ( long param1, long param2 )
FuncType FunctionArray[256];
// I use the macro FUNCBUILDER for this, especially for
// script-accessible function writing.
FUNCBUILDER( MyFunction );
FUNCBUILDER( MyFunction ) {
return (param1 + param2) * 2;
}
// The above macros expand to this code exactly.
int MyFunction( long param1, long param2 );
int MyFunction( long param1, long param2 ) {
return (param1 + param2) * 2;
}
void main( void ) {
int myReturn;
// This syntax works... I've tried it with Borland's 32-bit
// C++ Builder version 5.5, and with MSVC++ 6.0.
FunctionArray[0] = MyFunction;
// Henceforth, these are identical calls.
myReturn = (FunctionArray[0])( (long)23, (long)100 );
myReturn = MyFunction( (long)23, (long)100 );
}
Also, follow the link Kosmo gave; I've been there. It helps.
[edited by - Wyrframe on March 21, 2003 9:46:24 PM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement