Click here to Skip to main content
15,893,668 members
Articles / Programming Languages / C++

Gecko! Embedded C++ scripting for your applications

Rate me:
Please Sign up or sign in to vote.
4.93/5 (23 votes)
31 Aug 20036 min read 240.9K   2.6K   102  
Embed a C++ compiler in your project, use C++ as a compiled "scripting" language!
// File generated by GeckoSetup on Fri Aug 29 14:45:57 2003

#include "stdafx.h"
#include "MyGecko.h"


typedef GECKO_NATIVE void   (GECKO_NATIVE_CALL* lpfnSetPlayerHealth)(int nNewHealth);
typedef GECKO_NATIVE void   (GECKO_NATIVE_CALL* lpfnAlertDamage)(int nDamage);
typedef GECKO_NATIVE void   (GECKO_NATIVE_CALL* lpfnAppendOutput)(LPCSTR szText);
typedef GECKO_NATIVE int   (GECKO_NATIVE_CALL* lpfnFoo)(int i);
typedef GECKO_NATIVE const char*   (GECKO_NATIVE_CALL* lpfnBar)(LPCSTR a, float d);


typedef struct
{
	lpfnSetPlayerHealth fnSetPlayerHealth;
	lpfnAlertDamage fnAlertDamage;
	lpfnAppendOutput fnAppendOutput;
	lpfnFoo fnFoo;
	lpfnBar fnBar;
} NATIVES;


GECKO_NATIVE void GECKO_NATIVE_CALL SetPlayerHealth(int nNewHealth);
GECKO_NATIVE void GECKO_NATIVE_CALL AlertDamage(int nDamage);
GECKO_NATIVE void GECKO_NATIVE_CALL AppendOutput(LPCSTR szText);
GECKO_NATIVE int GECKO_NATIVE_CALL foo(int i);
GECKO_NATIVE const char* GECKO_NATIVE_CALL bar(LPCSTR a, float d);

void Gecko_RegisterNatives(CGecko &gecko)
{
	NATIVES natives;
	natives.fnSetPlayerHealth = SetPlayerHealth;
	natives.fnAlertDamage = AlertDamage;
	natives.fnAppendOutput = AppendOutput;
	natives.fnFoo = foo;
	natives.fnBar = bar;

	gecko.eckSendMessage(GM_REGISTER_NATIVES, (WPARAM)&natives);
}

void Gecko_Init(char *geckodir, char *mingwdir)
{
	strcpy(geckodir, "MyGeckoDir");
	strcpy(mingwdir, "MinGW\\bin");
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer
France France
Bouh

Comments and Discussions