Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood), 1,268 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Once Again a Script Crash #412070
11/22/12 13:37
11/22/12 13:37
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Code:
int InitilizeApplet(Applet * applet)
{
	if(applet->init) { return error("InitilizeApplet:Applet already initilized."); }
	void func();
	func = applet->Initilize;
	func();
	return 0;
}



It's understood by the title!Something is causing a Script Crash in this function.


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: Once Again a Script Crash [Re: Yashas] #412080
11/22/12 14:29
11/22/12 14:29
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
applet->Initilize is not a valid function pointer (or applet points to garbage).
I really don't want to offend you, but looking at your thread history I would highly suggest you to learn a bit about pointers as it appears like you are doing the same basic errors over and over again.

Last edited by JustSid; 11/22/12 14:33. Reason: Clarified that applet shouldn't be a function pointer

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Once Again a Script Crash [Re: WretchedSid] #412096
11/22/12 16:35
11/22/12 16:35
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Mastering Pointers.......(Learning) laugh

I did not understand what you meant by applet->initilize is not a valid function.

Here is a more clear explanation:
Everything starts here in my configuration file
Code:
void InitApplets ()
{
	Applet * Calender;
	Calender = CreateApplet("Calender","Tex","1.0","Displays Day,Month,Year",AppletCalenderPanel,AppletCalender_Drag,AppletCalenderInit,AppletCalenderDeInit);
	RegisterApplet(Calender);
	
	
}


I give AppletCalenderInit function as function parameter.

And that parameter is processed here:
Code:
Applet * CreateApplet(STRING * Name,STRING * Author,STRING * Version,STRING * Description,PANEL * Container,BMAP * Drag,int * Initilizer,int * Deinitlizer)
{
	if(!Container) { return error("CreateApplet:Invalid Container."); }
	if(!Initilizer) { return error("CreateApplet:Invalid Initilizer."); }
	if(!Deinitlizer) { return error("CreateApplet:Invalid Deinitilizer."); }
	if(!Name) { return error("CreateApplet:Invalid Name."); }
	
	Applet * Temp = sys_malloc(sizeof(Applet));
	
        .....SOME STATEMENTS ARE HERE WHICH ARE NOT RELATED TO THIS       
        TOPIC:REMOVED         

	Temp->Initilize	= Initilizer;
	Temp->Deinitlize = Deinitlizer;
	return Temp;
}



The structure stores the functions as:
Code:
typedef struct Applet 
{
        ........

	void *Initilize;
	void *Deinitlize;

        ........
} Applet;



Now it must be very clear laugh


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: Once Again a Script Crash [Re: Yashas] #412099
11/22/12 16:47
11/22/12 16:47
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
Didnt look it all over but i saw this
applet *temp=malloc(sizeof(applet))
Try
applet *temp=(applet*)malloc(sizeof(applet))
i might be wrong with it as i just stared at that part and nothing else


Compulsive compiler

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

Gamestudio download | chip programmers | 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