Quote:Original post by PumpkinPieman
I don't use the boost library, is there any other way?
Are you willing to alter your function call syntax?
Are you willing to preprocess your source code with a custom tool?
Quote:Original post by PumpkinPieman
I don't use the boost library, is there any other way?
Quote:Original post by FrunyQuote:Original post by PumpkinPieman
I don't use the boost library, is there any other way?
Are you willing to alter your function call syntax?
Are you willing to preprocess your source code with a custom tool?
Quote:Original post by PumpkinPieman
I don't use the boost library, is there any other way?
Quote:Original post by Way WalkerQuote:Original post by PumpkinPieman
I don't use the boost library, is there any other way?
How does AngelScript expect the arguments? That'd determine how I'd solve it.
Quote:
This might help: Gem: A Generic Function Binding Interface
class CallASFunction { public: class Address { public: void *address; Address(void *a = 0) : address(a) {} }; private: asIScriptContext *context; unsigned int argumentCount; public: CallASFunction(asIScriptEngine &engine, int functionID) : context(0), argumentCount(0) { context = engine.CreateContext(); context->Prepare(functionID); } ~CallASFunction() { context->Release(); } private: CallASFunction(); // No touchy CallASFunction(const CallASFunction &cf); // No touchy CallASFunction & operator=(const CallASFunciton &cf); // No touchy public: friend CallASFunction & operator<<(CallASFunction &cf, asDWORD value); friend CallASFunction & operator<<(CallASFunction &cf, asQWORD value); friend CallASFunction & operator<<(CallASFunction &cf, float value); friend CallASFunction & operator<<(CallASFunction &cf, double value); friend CallASFunction & operator<<(CallASFunction &cf, void *value); friend CallASFunction & operator<<(CallASFunction &cf, Address value); public: void execute(asDWORD &out) { out = context->Execute() == asEXECUTION_FINISHED ? context->GetReturnDWord() : 0; } void execute(asQWORD &out) { out = context->Execute() == asEXECUTION_FINISHED ? context->GetReturnQWord() : 0; } void execute(float &out) { out = context->Execute() == asEXECUTION_FINISHED ? context->GetReturnFloat() : 0; } void execute(double &out) { out = context->Execute() == asEXECUTION_FINISHED ? context->GetReturnDouble() : 0; } void execute(void **out) { *out = context->Execute() == asEXECUTION_FINISHED ? context->GetReturnObject() : 0; } void execute(Address &out) { out.address = context->Execute() == asEXECUTION_FINISHED ? context->GetReturnAddress() : 0; }};CallASFunction & operator<<(CallASFunction &cf, asDWORD value) { cf.context->SetArgDWord(argumentCount, value); ++argumentCount;}CallASFunction & operator<<(CallASFunction &cf, asQWORD value) { cf.context->SetArgQWord(argumentCount, value); ++argumentCount;}CallASFunction & operator<<(CallASFunction &cf, float value) { cf.context->SetArgFloat(argumentCount, value); ++argumentCount;}CallASFunction & operator<<(CallASFunction &cf, double value) { cf.context->SetArgDouble(argumentCount, value); ++argumentCount;}CallASFunction & operator<<(CallASFunction &cf, void *value) { cf.context->SetArgObject(argumentCount, value); ++argumentCount;}CallASFunction & operator<<(CallASFunction &cf, Address value) { cf.context->SetArgAddress(argumentCount, value.address); ++argumentCount;}