Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Too many positionals passed" in NativeCall sub binding

I have this defined:

use NativeCall;

unit module kazmath;

class mat4 is repr('CStruct') {
    HAS num32 @.mat[16] is CArray;
}

sub kmMat4Fill( mat4 $mat, num32 @filler ) returns mat4 is native('kazmath')
                                            is export {*}

The function to bind is defined here:

kmMat4* kmMat4Fill(kmMat4* pOut, const kmScalar* pMat);

And the error returned is:

Too many positionals passed; expected 2 arguments but got 3

I really can't figure this out.

like image 242
jjmerelo Avatar asked Jun 14 '20 08:06

jjmerelo


1 Answers

This is fixed with

sub kmMat4Fill( mat4 $mat, CArray[num32] $filler )
        returns mat4 is native('kazmath') is export {*}

Positionals can't be used in NativeCall, but still, the error message is LTA (Less Than Awesome).

like image 133
jjmerelo Avatar answered Oct 20 '22 12:10

jjmerelo