Re: Plugins as game data
- From: Kenneth 'Bessarion' Boyd <zaimoni@xxxxxxxxxxx>
- Date: Mon, 17 Dec 2007 21:37:03 +0000 (UTC)
On 2007-12-17 22:02:54, konijn_ <konijn@xxxxxxxxx> wrote:
On Dec 17, 3:19 pm, jice wrote:
You don't have to use a global variable to pass parameters to a
dynamically linked function.
Once you have the address of the function, cast it using a function
pointer :
// declaration of the function pointer
void (*addDamageTypePtr)(char *type, char *value);
// address of the function retrieved from the dll (see my previous
post)
void * myFunctionAddress =3D ...
// cast your void * address into the right function pointer
addDamageTypePtr =3D myFunctionAddress;
// then use it as a standard function
addDamageTypePtr("Acid","10d4");
But, splutter ;)
That would mean that my parsing routine would need to know about
addDamageType which I want to avoid.
In my design, only the script/module and the called function need to
know which parameters are used, the parser just parses parameters and
calls functions.
Assuming that all data types involved in the function call are ...-friendly, try
casting to
void (*omnifunc_type)(....)
This requires C calling convention for everything, but should let the parser be
clueless about the actual function type.
.
- Follow-Ups:
- Re: Plugins as game data
- From: konijn_
- Re: Plugins as game data
- From: Gelatinous Mutant Coconut
- Re: Plugins as game data
- References:
- Plugins as game data
- From: Radomir 'The Sheep' Dopieralski
- Re: Plugins as game data
- From: Ray Dillinger
- Re: Plugins as game data
- From: konijn_
- Re: Plugins as game data
- From: jice
- Re: Plugins as game data
- From: konijn_
- Plugins as game data
- Prev by Date: Re: Plugins as game data
- Next by Date: Re: Plugins as game data
- Previous by thread: Re: Plugins as game data
- Next by thread: Re: Plugins as game data
- Index(es):
Relevant Pages
|
Loading