Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
|
|
@ -0,0 +1,23 @@
|
|||
:- module test_ffi.
|
||||
|
||||
:- interface.
|
||||
|
||||
:- import_module io.
|
||||
|
||||
:- pred main(io::di, io::uo) is det.
|
||||
|
||||
:- implementation.
|
||||
|
||||
% The actual FFI code begins here.
|
||||
:- pragma foreign_decl("C", "char *strdup(const char *s);").
|
||||
|
||||
:- func strdup(string::in) = (string::out) is det.
|
||||
:- pragma foreign_proc("C", strdup(S::in) = (SD::out),
|
||||
[will_not_call_mercury, not_thread_safe, promise_pure],
|
||||
"SD = strdup(S);").
|
||||
% The actual FFI code ends here.
|
||||
|
||||
main(!IO) :-
|
||||
io.write_string(strdup("Hello, worlds!\n"), !IO).
|
||||
|
||||
:- end_module test_ffi.
|
||||
|
|
@ -0,0 +1 @@
|
|||
:- func strdup(string) = string.
|
||||
Loading…
Add table
Add a link
Reference in a new issue