Thanks for reply, Andreas.
I will try some redisign my architecture for it.
I create some extention/plugin programm for some commercial app, which not have public documented api, and their "liver" little changed from version to version.
And users may have and worked with any different version of that app, sometimes even at the same time.
At first I wrote in C++, but now support interoperability with multiple versions at the same time - has turned into hell - changed func address, signatures, virtual table order, offsets in structs and many others.
So I decided to port my software to the AngelScript.
Now core of my programm first created some intermediate layer for call native function from extending app, and than run script on AngelScript.
And intermediate layer partially prepared with module on AngelScript too - I was simply register in script engine some of their "RegisterNNN" func :)
For example:
int registerObjectType(const CStringMy& objectName, unsigned size, unsigned typeFlags)
{
return asEngine->RegisterObjectType(CStringA(objectName), size, typeFlags);
}
AS_FUNC(regType_as, "int registerObjectType(const string& in,uint,uint)", ®isterObjectType);
int registerMethodByAddres(const CStringMy& object, const CStringMy& method, unsigned addr, unsigned cc)
{
if (object.IsEmpty()) {
return asEngine->RegisterGlobalFunction(CStringA(method), asFUNCTION(addr), cc, 0);
} else {
asSFuncPtr p(3);
*(unsigned*)p.ptr.dummy = addr;
return asEngine->RegisterObjectMethod(CStringA(object), CStringA(method), p, cc, 0);
}
}
AS_FUNC(regMetAddr_as, "int registerMethodByAddress(const string& in,const string& in,uint,uint)", ®isterMethodByAddres);
First I created "compatible" module and run it, it register API functions depending on version of running parent app, and than I create main module, which do main work.
But now I have developed some kind of declarative description for the creation of an intermediate layer for different versions, and the need for such a decision unnecessary.