support cstr as an ffi return type and do some more restructuring
This commit is contained in:
committed by
Bennet Bleßmann
parent
9cccd509e3
commit
0c2c6124eb
16
tests-pl/ffi_cstr.pl
Normal file
16
tests-pl/ffi_cstr.pl
Normal file
@@ -0,0 +1,16 @@
|
||||
:- use_module(library(os)).
|
||||
:- use_module(library(ffi)).
|
||||
|
||||
test :-
|
||||
read(Body),
|
||||
term_variables(Body, [LIB]),
|
||||
Body,
|
||||
use_foreign_module(LIB, [
|
||||
'ffi_cstr_len'([cstr], u64),
|
||||
'ffi_example_cstr'([], cstr)
|
||||
]),
|
||||
ffi:'ffi_cstr_len'("Scryer Prolog", Len),
|
||||
ffi:'ffi_example_cstr'(Str),
|
||||
write((Len-Str)).
|
||||
|
||||
:- initialization(test).
|
||||
Reference in New Issue
Block a user