# New Ticket Created by Donald Hunter
# Please include the string: [perl #56828]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56828 >
Added support for void** params, i.e. for out parameters. This is
required for functions such as:
int sqlite3_open(
const char *filename, /* Database filename (UTF-8) */
sqlite3 **ppDb /* OUT: SQLite db handle */
);
Changed tools/build/nativecall.pl
Added V to %proto_type and to %sig_char.
Added emitter for V to sub make_arg().
The changes allow me to pass a Pointer PMC into an NCI call that takes a
void**. E.g.
.local pmc lib
lib = loadlib 'sqlite3'
.local pmc func
func = dlfunc lib, 'sqlite3_open', 'itV'
store_global 'sqlite3::open', func
.local pmc sqlite
sqlite = new 'Pointer'
$S0 = 'c:/dev/test.db'
$I0 = sqlite3::open($S0, sqlite)
Regards,
Donald Hunter.
Index: tools/build/nativecall.pl
===================================================================
--- tools/build/nativecall.pl (revision 29223)
+++ tools/build/nativecall.pl (working copy)
@@ -82,6 +82,7 @@
B => "void **",
L => "long *",
T => "char **",
+ V => "void **",
'@' => "PMC *", # slurpy array
);
@@ -186,6 +187,7 @@
N => "N",
B => "S",
v => "v",
+ V => "P",
J => "",
'@' => '@',
);
@@ -439,6 +441,11 @@
push @{$extra_preamble_ref}, "t_$temp_num = GET_NCI_P($reg_num);";
return "PMC_data(t_$temp_num)";
};
+ /V/ && do {
+ push @{$temps_ref}, "PMC *t_$temp_num;";
+ push @{$extra_preamble_ref}, "t_$temp_num = GET_NCI_P($reg_num);";
+ return "(void**)&PMC_data(t_$temp_num)";
+ };
/i/ && do {
push @{$temps_ref}, "int t_$temp_num;";
push @{$extra_preamble_ref}, "t_$temp_num = (int)GET_NCI_I($reg_num);";