@@ -47,15 +47,19 @@ BEGIN {
47
47
class Call is repr(' NativeCall' ) { }
48
48
class CPointer is repr(' CPointer' ) { }
49
49
50
- # my $printf := nqp::create(Call);
51
50
my $ printf := Call. new ;
52
51
$ arg_hash := nqp ::hash();
53
52
$ arg_hash <type > := ' utf8str' ;
54
53
$ arg_hash <free_str > := 1 ;
55
54
$ return_hash := nqp ::hash();
56
55
$ return_hash <type > := ' void' ;
57
56
58
- nqp ::buildnativecall($ printf , ' ' , ' printf' , ' ' , [$ arg_hash ], $ return_hash );
57
+ try {
58
+ nqp ::buildnativecall($ printf , ' ' , ' printf' , ' ' , [$ arg_hash ], $ return_hash );
59
+ CATCH {
60
+ nqp ::buildnativecall($ printf , ' msvcrt.dll' , ' printf' , ' ' , [$ arg_hash ], $ return_hash );
61
+ }
62
+ }
59
63
nqp ::nativecall(nqp ::null(), $ printf , [" ok - printf\n " ]);
60
64
61
65
my $ strdup := nqp ::create(Call);
@@ -68,7 +72,7 @@ $return_hash<type> := 'cpointer';
68
72
try {
69
73
nqp ::buildnativecall($ strdup , ' ' , ' strdup' , ' ' , [$ arg_hash ], $ return_hash );
70
74
CATCH {
71
- nqp ::buildnativecall($ strdup , ' ' , ' _strdup' , ' ' , [$ arg_hash ], $ return_hash );
75
+ nqp ::buildnativecall($ strdup , ' msvcrt.dll ' , ' _strdup' , ' ' , [$ arg_hash ], $ return_hash );
72
76
}
73
77
}
74
78
my $ dupped := nqp ::nativecall(CPointer, $ strdup , [" ok - passing cpointer\n " ]);
@@ -80,7 +84,12 @@ $arg_hash<type> := 'cpointer';
80
84
$ return_hash := nqp ::hash();
81
85
$ return_hash <type > := ' void' ;
82
86
83
- nqp ::buildnativecall($ printf , ' ' , ' printf' , ' ' , [$ arg_hash ], $ return_hash );
87
+ try {
88
+ nqp ::buildnativecall($ printf , ' ' , ' printf' , ' ' , [$ arg_hash ], $ return_hash );
89
+ CATCH {
90
+ nqp ::buildnativecall($ printf , ' msvcrt.dll' , ' printf' , ' ' , [$ arg_hash ], $ return_hash );
91
+ }
92
+ }
84
93
nqp ::nativecall(nqp ::null(), $ printf , [$ dupped ]);
85
94
86
95
# vim: ft=perl6
0 commit comments