Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17063

Class constructor/destructor registration for asCALL_GENERIC

$
0
0

I'm struggling registering class constructor and destructors following the example in “Registering a Value Type”. For,

r = m_pEngine->RegisterObjectType("Motor", sizeof(Motor), asOBJ_VALUE); assert(r >= 0);

The example implies I cannot register Motor::Motor(); that a “factory function” should be use? It looks like the example is registering a global Constructor(void *memory), not a class member. So I have,

void CallConstructor(void* memory)
{
	new(memory) Motor();
}

r = mpEngine->RegisterObjectBehaviour("Motor", asBEHAVE_CONSTRUCT, "void CallConstructor(void*)", WRAP_CON(CallConstuctor, void*), asCALL_GENERIC); assert(r >= 0);

Compiler error: type/value mismatch as argument 1 in template parameter list for ‘template<class T> struct gw …


Viewing all articles
Browse latest Browse all 17063

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>