memory system threads tools.test math accessors combinators
specialized-arrays.float ;
+<<
+: libfactor-ffi-tests-path ( -- string )
+ {
+ { [ os winnt? ] [ "resource:libfactor-ffi-test.dll" ] }
+ { [ os macosx? ] [ "resource:libfactor-ffi-test.dylib" ] }
+ { [ os unix? ] [ "resource:libfactor-ffi-test.so" ] }
+ } cond ;
+
+"f-cdecl" libfactor-ffi-tests-path "cdecl" add-library
+
+"f-stdcall" libfactor-ffi-tests-path "stdcall" add-library
+>>
+
+LIBRARY: f-cdecl
+
FUNCTION: void ffi_test_0 ;
[ ] [ ffi_test_0 ] unit-test
"int" { "int" "int" "int" "int" } "stdcall" alien-indirect
gc ;
-<< "f-stdcall" f "stdcall" add-library >>
+LIBRARY: f-stdcall
-[ f ] [ "f-stdcall" load-library ] unit-test
+[ f ] [ "f-stdcall" load-library f = ] unit-test
[ "stdcall" ] [ "f-stdcall" library abi>> ] unit-test
: ffi_test_18 ( w x y z -- int )
: ffi_test_31 ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a -- result y )
"int"
- f "ffi_test_31"
+ "f-stdcall" "ffi_test_31"
{ "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" }
alien-invoke gc 3 ;
: ffi_test_31_point_5 ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a -- result )
"float"
- f "ffi_test_31_point_5"
+ "f-stdcall" "ffi_test_31_point_5"
{ "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" }
alien-invoke ;
! Copyright (C) 2004, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs kernel math namespaces sequences system
-kernel.private byte-arrays arrays init ;
+kernel.private byte-arrays arrays init io.backend ;
IN: alien
! Some predicate classes used by the compiler for optimization
library dup [ dll>> ] when ;
: add-library ( name path abi -- )
+ [ dup [ normalize-path ] when ] dip
<library> swap libraries get set-at ;
ERROR: alien-callback-error ;
: initialize-alien ( symbol quot -- )
swap dup get-global dup recompute-value?
[ drop [ call dup 31337 <alien> expiry-check boa ] dip set-global ]
- [ 2nip object>> ] if ; inline
\ No newline at end of file
+ [ 2nip object>> ] if ; inline