Skip to content

Commit 0e6e6d2

Browse files
committed
Reflows and link nativetype → nativecall
And the other way round. Refs #1512
1 parent 0bfe6e6 commit 0e6e6d2

File tree

2 files changed

+11
-45
lines changed

2 files changed

+11
-45
lines changed

doc/Language/nativecall.pod6

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
X<|nativecall>
1010
11-
The simplest imaginable use of NativeCall would look something like this:
11+
The simplest imaginable use of C<NativeCall> would look something like this:
1212
1313
use NativeCall;
1414
sub some_argless_function() is native('something') { * }
@@ -59,47 +59,13 @@ an example.
5959
use NativeCall;
6060
sub add(int32, int32) returns int32 is native("calculator") { * }
6161
62-
Here, we have declared that the function takes two 32-bit integers and returns
63-
a 32-bit integer. Here are some of the other types that you may pass (this will
64-
likely grow with time).
65-
66-
X<|int8>X<|int16>X<|int32>X<|int64>X<|uint8>X<|uint16>X<|uint32>X<|uint64>X<|long>X<|longlong>X<|ulong>X<|ulonglong>X<|num32>X<|num64>X<|Str>X<|Pointer>X<|bool>X<|size_t>X<|ssize_t>
67-
=begin table
68-
int (long in C)
69-
int8 (int8_t in C, also used for char)
70-
int16 (int16_t in C, also used for short)
71-
int32 (int32_t in C, also used for int)
72-
int64 (int64_t in C)
73-
uint (ulong in C)
74-
uint8 (uint8_t in C, also used for unsigned char)
75-
uint16 (uint16_t in C, also used for unsigned short)
76-
uint32 (uint32_t in C, also used for unsigned int)
77-
uint64 (uint64_t in C)
78-
long (long in C)
79-
longlong (long long in C, at least 64-bit)
80-
ulong (unsigned long in C)
81-
ulonglong (unsigned long long in C, at least 64-bit)
82-
longdouble (longdouble in C)
83-
Num, num (double in C)
84-
num32 (float in C)
85-
num64 (double in C)
86-
Str (C string)
87-
CArray[int32] (int32_t* in C, an array of 32-bit ints)
88-
Pointer[void] (void* in C, can point to all other types)
89-
bool (bool from C99)
90-
size_t (size_t in C)
91-
ssize_t (ssize_t in C)
92-
Callable (callback in C)
93-
=end table
94-
95-
Don't use Perl 6 native types like C<int> or C<num> in native calls, as they
96-
don't have to correspond to the local C equivalent (e.g., Perl 6's C<int> can be
97-
8 bytes but C's C<int> is only 4 bytes).
98-
99-
Note that the lack of a C<returns> trait is used to indicate C<void> return type.
100-
Do I<not> use the C<void> type anywhere except in the Pointer parameterization.
101-
102-
For strings, there is an additional "encoded" trait to give some extra hints on
62+
Here, we have declared that the function takes two 32-bit integers and returns a
63+
32-bit integer. You can find the other types that you may pass in the
64+
L<native types|/language/nativetypes> page. Note that the lack of a C<returns>
65+
trait is used to indicate C<void> return type. Do I<not> use the C<void> type
66+
anywhere except in the Pointer parameterization.
67+
68+
For strings, there is an additional C<encoded> trait to give some extra hints on
10369
how to do the marshaling.
10470
10571
use NativeCall;

doc/Language/nativetypes.pod6

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ X<|int>X<|uint>X<|num>X<|str>
1515
=end table
1616
1717
However, these types do not necessarily have the size that is required by the
18-
NativeCall interface (e.g., Perl 6's C<int> can be 8 bytes but C's C<int> is
19-
only 4 bytes). Instead, the types below will have to be used instead of the
20-
types C<int> or C<num> listed above.
18+
L<NativeCall|/lang/nativecall> interface (e.g., Perl 6's C<int> can be 8 bytes
19+
but C's C<int> is only 4 bytes). Instead, the types below will have to be used
20+
instead of the types C<int> or C<num> listed above.
2121
2222
X<|int8>X<|int16>X<|int32>X<|int64>X<|uint8>X<|uint16>X<|uint32>X<|uint64>X<|num32>X<|num64>
2323
=begin table

0 commit comments

Comments
 (0)