Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The error message of CStruct recommends to use Perl 6 native types #5692

Closed
p6rt opened this issue Sep 25, 2016 · 4 comments
Closed

The error message of CStruct recommends to use Perl 6 native types #5692

p6rt opened this issue Sep 25, 2016 · 4 comments
Labels
LTA Less Than Awesome; typically an error message that could be better NativeCall

Comments

@p6rt
Copy link

p6rt commented Sep 25, 2016

Migrated from rt.perl.org#129353 (status was 'resolved')

Searchable as RT129353$

@p6rt
Copy link
Author

p6rt commented Sep 25, 2016

From @titsuki

See the following results.

$ perl6 -MNativeCall -e 'class A is repr("CStruct") { has $.a; }'
===SORRY!=== Error while compiling -e
CStruct representation only handles int, num, CArray, CPointer, CStruct, CPPStruct and CUnion
at -e​:1

It looks wrong for me, because the Perl 6 official document says​:

Don't use Perl 6 native types like int or num, as they don't have to correspond to the local C equivalent (e.g., Perl 6's int can be 8 bytes but C's int is only 4 bytes).

(From https://docs.perl6.org/language/nativecall#Passing_and_Returning_Values)

$ perl6 --version
This is Rakudo version 2016.08.1-202-g78393dd built on MoarVM version 2016.08-47-g2eedba8
implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented Oct 9, 2016

From @FROGGS

Fixed with​:
MoarVM/MoarVM@688796b434
rakudo/rakudo@a92f092ac5

The error message now reads​:

$ perl6 -e 'class Foo is repr<CStruct> { has Buf $.a }'
===SORRY!=== Error while compiling -e
CStruct representation only handles attributes of type​:
  (u)int8, (u)int16, (u)int32, (u)int64, (u)long, (u)longlong, num16, num32, (s)size_t, bool, Str
  and types with representation​: CArray, CPointer, CStruct, CPPStruct and CUnion
at -e​:1

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 9, 2016

From @FROGGS

Fixed with​:
MoarVM/MoarVM@688796b434
rakudo/rakudo@a92f092ac5

The error message now reads​:

$ perl6 -e 'class Foo is repr<CStruct> { has Buf $.a }'
===SORRY!=== Error while compiling -e
CStruct representation only handles attributes of type​:
  (u)int8, (u)int16, (u)int32, (u)int64, (u)long, (u)longlong, num16, num32, (s)size_t, bool, Str
  and types with representation​: CArray, CPointer, CStruct, CPPStruct and CUnion
at -e​:1

@p6rt p6rt closed this as completed Oct 9, 2016
@p6rt
Copy link
Author

p6rt commented Oct 9, 2016

@FROGGS - Status changed from 'new' to 'resolved'

@p6rt p6rt added LTA Less Than Awesome; typically an error message that could be better NativeCall labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better NativeCall
Projects
None yet
Development

No branches or pull requests

1 participant