SerialPort port(1, 100);
void main()
{
if (port.Open())
{
MessageBox("COM port opened successfully");
}
else
{
MessageBox("Unable to open COM port!");
}
}
I get the AS compiler message:
ERR : Data type can't be 'SerialPort'
'SerialPort' is a class registered through the following code.
r = engine->RegisterObjectType("SerialPort", 0, asOBJ_REF); ASSERT( r >= 0 );
r = engine->RegisterObjectBehaviour("SerialPort", asBEHAVE_FACTORY, "SerialPort @f(uint16 comPort, uint rxFifoSize)", asFUNCTION(MbSerial_Factory), asCALL_CDECL); ASSERT( r >= 0 );
r = engine->RegisterObjectBehaviour("SerialPort", asBEHAVE_ADDREF, "void f()", asMETHOD(CMbSerial,AddRef), asCALL_THISCALL); ASSERT( r >= 0 );
r = engine->RegisterObjectBehaviour("SerialPort", asBEHAVE_RELEASE, "void f()", asMETHOD(CMbSerial,Release), asCALL_THISCALL); ASSERT( r >= 0 );
here's the factory function I use:
CMbSerial *MbSerial_Factory(WORD comPort, DWORD rxFifoSize)
{
return new CMbSerial(comPort, rxFifoSize);
}
Any hints what could go wrong here? I'm using AngelScript 2.17.0 and VC++ 6.0 IDE
Thanks for reading!