What i would like to do:
C++:
void print(const char *str){
printf("%s",str);
}
Script:
print("text");
Thanks in advance.
void print(const char *str){
printf("%s",str);
}
print("text");
engine->RegisterObjectType("charptr", sizeof(const char *), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_PRIMITIVE);
engine->RegisterGlobalFunction("void print(charptr)", asFUNCTION(print), asCALL_CDECL);
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Don't support passing type 'charptr' by value to application in native calling convention on this platform
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
#ifdef SPLIT_OBJS_BY_MEMBER_TYPES
// It's not safe to pass objects by value because different registers
// will be used depending on the memory layout of the object
// Ref: http://www.x86-64.org/documentation/abi.pdf
// Ref: http://www.agner.org/optimize/calling_conventions.pdf
if(
#ifdef COMPLEX_OBJS_PASSED_BY_REF
!(func->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK) &&
#endif
#ifdef LARGE_OBJS_PASS_BY_REF
func->parameterTypes[n].GetSizeInMemoryDWords() < AS_LARGE_OBJ_MIN_SIZE &&
#endif
- !(func->parameterTypes[n].GetObjectType()->flags & (asOBJ_APP_CLASS_ALLINTS | asOBJ_APP_CLASS_ALLFLOATS)) )
+ !(func->parameterTypes[n].GetObjectType()->flags & (asOBJ_APP_PRIMITIVE | asOBJ_APP_FLOAT | asOBJ_APP_CLASS_ALLINTS | asOBJ_APP_CLASS_ALLFLOATS)) )
{
engine->WriteMessage("", 0, 0, asMSGTYPE_INFORMATION, func->GetDeclarationStr().AddressOf());
asCString str;
str.Format(TXT_DONT_SUPPORT_TYPE_s_BY_VAL, func->parameterTypes[n].GetObjectType()->name.AddressOf());
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, str.AddressOf());
engine->ConfigError(asINVALID_CONFIGURATION, 0, 0, 0);
}
#endif
// An object is being passed by value
if( (descr->parameterTypes[a].GetObjectType()->flags & COMPLEX_MASK) ||
descr->parameterTypes[a].GetSizeInMemoryDWords() > 4 )
{
// Copy the address of the object
argsType[argIndex] = x64INTARG;
memcpy(paramBuffer + argIndex, stack_pointer, sizeof(asQWORD));
argIndex++;
}
- else if( descr->parameterTypes[a].GetObjectType()->flags & asOBJ_APP_CLASS_ALLINTS )
+ else if( (descr->parameterTypes[a].GetObjectType()->flags & asOBJ_APP_CLASS_ALLINTS) || (descr->parameterTypes[a].GetObjectType()->flags & asOBJ_APP_PRIMITIVE) )
{
// Copy the value of the object
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game