Re: I need help with NativeCall

2018-03-05 Thread Curt Tilmes
I built a bit on Richard's work.. On Sat, Mar 3, 2018 at 2:12 AM, Richard Hainsworth wrote: > In addition, I have not figured out how to access CStruct variables yet. They are mostly like normal classes, but unpacking native C bits isn't always straightforward. In this

Re: I need help with NativeCall

2018-03-05 Thread Curt Tilmes
I also see another bug: method flags { do for AddrInfo-Flags.enums { .key if $!ai_flags +| .value } } should be method flags { do for AddrInfo-Flags.enums { .key if $!ai_flags +& .value } } Though you probably don't even need the flags.. Curt

Re: I need help with NativeCall

2018-03-05 Thread Curt Tilmes
On Sat, Mar 3, 2018 at 10:58 PM, Richard Hainsworth wrote: > I realised from the C documentation that a fixed 14 byte variable was > required, but I could not find a mention about how to map that into Perl6. > Suppose it was necessary to create a structure, how would this

Re: I need help with NativeCall

2018-03-04 Thread ToddAndMargo
On 03/04/2018 06:56 AM, Curt Tilmes wrote: I also see another bug: method flags { do for AddrInfo-Flags.enums { .key if $!ai_flags +| .value } } should be method flags { do for AddrInfo-Flags.enums { .key if $!ai_flags +& .value } } Though you probably

Re: I need help with NativeCall

2018-03-03 Thread Richard Hainsworth
Curt, Thanks, your code really helped me. But some questions: I've had trouble with CStruct types and "is rw", so I usually just make those "Pointer is rw" to get the pointer back, then use nativecast() to make it into the CStruct type I want. This is useful, and a comment in the

Re: I need help with NativeCall

2018-03-02 Thread Richard Hainsworth
Todd, I figured out some of NativeCall by working with the GTK subroutines. Eventually, I had to write some programs in C to use GTK natively before getting a good understanding about how GTK-Simple works. In addition, I have not figured out how to access CStruct variables yet. So my code

Re: I need help with NativeCall

2018-03-02 Thread ToddAndMargo
On 03/02/2018 11:31 AM, ToddAndMargo wrote: Hi All, https://docs.perl6.org/language/nativecall I just don't understand. I want specifically (not a work around) want to make a call to "getaddrinfo" and I don't know how to write in C. (It is part of troubleshooting some other code that uses