Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, OptimusPrime), 15,359 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Get function pointer #153257
09/10/07 16:03
09/10/07 16:03
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline OP
Member
dennis  Offline OP
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
Hi!

How can I get a pointer to a function using a string which contains the name of the function?

I thought of something like that....

Code:
STRING* NameOfFunction = "Test_Fun";
voidptr = ????(NameOfFunction);



Re: Get function pointer [Re: dennis] #153258
09/10/07 20:38
09/10/07 20:38
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You can use engine_getvar here.


Always learn from history, to be sure you make the same mistakes again...
Re: Get function pointer [Re: Uhrwerk] #153259
09/11/07 11:30
09/11/07 11:30
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline OP
Member
dennis  Offline OP
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
I tried that:

Code:
 
#include <acknex.h>
#include <default.c>

function Test_Fun()
{
wait(-10);
sys_exit("");
}

STRING* NameOfFunction = "Test_Fun";

void* voidptr()
{

wait(1);

}

long type;

function main()
{

wait(1);

voidptr = engine_getvar(NameOfFunction,type);

voidptr();

}



It did not work...."Error E1513: Crash in main"

How can I do that correctly?

Re: Get function pointer [Re: dennis] #153260
09/11/07 12:00
09/11/07 12:00
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
http://manual.conitec.net/engine_getscript.htm

But for what reason do you need to find a function by its name? Why don't you call the function directly?

Re: Get function pointer [Re: jcl] #153261
09/11/07 12:30
09/11/07 12:30
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline OP
Member
dennis  Offline OP
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...

Oh yes...that works..!

I want to make a GUI-Editor and want to change the event function of a panel by user input.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1