@@ -39,16 +39,16 @@ routine in your library that may be different from your Perl subroutine name.
39
39
40
40
module Foo;
41
41
use NativeCall;
42
- our sub Init () is native('libfoo') is symbol('FOO_INIT') { * }
42
+ our sub init () is native('libfoo') is symbol('FOO_INIT') { * }
43
43
44
44
Inside of "libfoo" there is a routine called "FOO_INIT" but, since we're
45
- creating a module called Foo and we'd rather call the routine as Foo::Init ,
45
+ creating a module called Foo and we'd rather call the routine as C < Foo::init > ,
46
46
we use the "symbol" trait to specify the name of the symbol in "libfoo"
47
- and call the subroutine whatever we want ("Init " in this case).
47
+ and call the subroutine whatever we want ("init " in this case).
48
48
49
49
= head1 Passing and Returning Values
50
50
51
- Normal Perl 6 signatures and the " returns" trait are used in order to convey
51
+ Normal Perl 6 signatures and the C < returns > trait are used in order to convey
52
52
the type of arguments a native function expects and what it returns. Here is
53
53
an example.
54
54
@@ -69,8 +69,8 @@ likely grow with time).
69
69
CArray[int32] (int* in C, an array of integers)
70
70
Pointer[void] (void* in C, can point to all other types)
71
71
72
- Note that the lack of a " returns" trait is used to indicate void return type.
73
- Do * not* use the 'void' type anywhere except in the Pointer parametrization.
72
+ Note that the lack of a C < returns > trait is used to indicate void return type.
73
+ Do I < not > use the 'void' type anywhere except in the Pointer parametrization.
74
74
75
75
For strings, there is an additional "encoded" trait to give some extra hints on
76
76
how to do the marshalling.
@@ -145,10 +145,10 @@ Here is an example of passing a C array.
145
145
@values[2] = 180.7e0;
146
146
RenderBarChart('Weights (kg)', 3, @titles, @values);
147
147
148
- Note that binding was used to @titles, *NOT* assignment! If you assign, you
148
+ Note that binding was used to C < @titles > , I < not > assignment! If you assign, you
149
149
are putting the values into a Perl 6 array, and it will not work out. If this
150
- all freaks you out, forget you ever knew anything about the "@" sigil and just
151
- use "$" all the way when using NativeCall. :-)
150
+ all freaks you out, forget you ever knew anything about the C < @ > sigil and just
151
+ use C < $ > all the way when using NativeCall. :-)
152
152
153
153
my $titles = CArray[Str].new;
154
154
$titles[0] = 'Me';
@@ -199,7 +199,7 @@ the memory is not managed for you.
199
199
200
200
NativeCall currently doesn't put object members in containers, so assigning new values
201
201
to them (with =) doesn't work. Instead, you have to bind new values to the private
202
- members: $!struct-member := StructObj.new;
202
+ members: C < $!struct-member := StructObj.new; >
203
203
204
204
As you may have predicted by now, a null is represented by the type object of the
205
205
struct type.
@@ -230,16 +230,21 @@ to callbacks.
230
230
231
231
TBD
232
232
233
- = head1 Running the Examples
233
+ = head1 Examples
234
234
235
- The examples directory contains various examples of how to use NativeCall:
236
- L < http://github.com/jnthn/zavolaj/tree/master/examples >
235
+ The L < zavolaj|https://github.com/jnthn/zavolaj > git repository (where NativeCall is
236
+ developed) hosts L < various examples|https://github.com/jnthn/zavolaj/tree/master/examples >
237
+ of how to use NativeCall.
237
238
238
- More examples can be found in the lib/DBDish/ directory of the DBIsh repository
239
- at L < http ://github.com/perl6/DBIish> .
239
+ More examples can be found L < in the DBIsh repository
240
+ |https ://github.com/perl6/DBIish/tree/master/lib/DBDish > .
240
241
241
242
= head2 MySQL
242
243
244
+ = comment TODO Do we really need this here? Seems like this info should just go
245
+ along-side that example in the git repo, rathern than replicated
246
+ on p6doc.
247
+
243
248
There is an example of using the MySQL client library. There is a project
244
249
L < http://github.com/mberends/minidbi > that wraps these functions with a DBI
245
250
compatible interface. You'll need that library to hand; on Debian-esque systems
0 commit comments