Hi,
I'm trying to call an AS function from C++ with a ref parameter (signature void main(int&in) or void main(int&out)).
According to the documentation this should work:
QuoteIf the parameter type is a reference to a primitive type it is recommended to use the SetArgDWord() method and pass the pointer as the value. For non-primitive types the method SetArgObject() should be used, which will be described in the next section.
This is my C++ code:
asDWORD input;
r = ctx->SetArgDWord(0, (asDWORD)&input);
But it returns asINVALID_TYPE and if I execute the function anyway I get an exception although ctx->GetExceptionString() just gives me null.
So I was wondering what am I doing wrong?
Thing I've tried so far:
- Compiling for 32- and 64-bit respectively linking to the 32- and 64-bit library.
- Changing SetArgDWord to SetArgQWord for 64-bit.
- Changing the AS function to void main(int32&in), void main(int64&in), void main(int32&out), void main(int64&out)
- passing input instead of &input
- using SetArgObject instead
OS: Ubuntu16.04 64 bit
Compiler: Gnu C++ Compiler
Angelscript version: 2.32.0
Can somebody help me on this?
Thanks and Regards