7

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.

jjmerelo
  • 22,578
  • 8
  • 40
  • 86
  • 1
    It might be related to the `extern "C" { }` declaration in `math4.h`. Maybe raku is passing an implicit `this` argument which is not expected? – Håkon Hægland Jun 14 '20 at 09:15
  • @HåkonHægland. It might, but that happens only if it's compiled with c++. I don't think that's the case. – jjmerelo Jun 14 '20 at 09:33

1 Answers1

5

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).

Elizabeth Mattijsen
  • 25,654
  • 3
  • 75
  • 105
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
  • 3
    With to all... I primarily associate `LTA` with an empathetic notion that speaks to both end users and implementors, an up-lifting *aspirational* connotation that some error messages are weak, even very weak, and need improvement, perhaps a lot. Sort of `LTA eqv Larry.Thinks.Aspirationally`. But part of the point of `@Larry`'s memes is artistic flexibility, and I find it fun to: remember what I've forgotten about a meme; discover meanings I didn't know; invent new ones; or share ones I think might apply in a particular scenario. In that vein: `LTA eqv Ludicrously.Tormentingly.Abstruse`. – raiph Jun 14 '20 at 11:53