Skip to content

Commit

Permalink
It works!
Browse files Browse the repository at this point in the history
  • Loading branch information
DouglasRMiles committed Nov 25, 2014
1 parent a60a041 commit b258636
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
8 changes: 4 additions & 4 deletions SWICFFITests/SWICFFITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ static SWICFFITestsProgram()

public static void Main(String[] args)
{
dynamic d = new PInvoke("libc");

for (int i = 0; i < 100; ++i)
d.printf("Hello, World %d\n", i);
dynamic d = new PInvoke("glibc");
PrologCLR.cliDynTest_1();
PrologCLR.cliDynTest_3();
PrologCLR.cliDynTest_2();
}
public static void install()
{
Expand Down
20 changes: 17 additions & 3 deletions Swicli.Library/PInvokeMetaObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,31 @@ static public dynamic cliGetDll(String dll)
}

[PrologVisible]
public static void cliDynTest1()
public static void cliDynTest_1()
{
Debug(typeof(System.Dynamic.DynamicObject).ToString());
}

[PrologVisible]
public static void cliDynTest_2()
{
dynamic d = new PInvoke("libc");

for (int i = 0; i < 2; ++i)
{
d.printf("Hello, World %d\n", i);
}
}

[PrologVisible]
public static void cliDynTest2()
public static void cliDynTest_3()
{
Debug(typeof(System.Dynamic.DynamicObject).ToString());
dynamic d = new PInvoke("libc");

for (int i = 0; i < 2; ++i)
{
int reallyIntReturn = d.printf("Hello, World %d\n", i);
}
}
}
public class PInvoke : DynamicObject
Expand Down
4 changes: 4 additions & 0 deletions swicffi.pl
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,11 @@
% cffi_tests :- forall(reader_tests,true).
cffi_tests :- forall(cffi_test,true).

% work!
cffi_test :- cli_get_dll('libc.so.6',DLL),cli_call(DLL,printf,["I have been clicked %d times", 2],O).
% fixing
cffi_test :- cli_get_dll('libc',DLL),cli_call(DLL,printf,["I have been clicked %d times", 2],O).
% not impl yet
cffi_test :- install_cffi('snake-tail','cffi-tests/swi-prolog.cffi'),module(swicffi),prolog.


0 comments on commit b258636

Please sign in to comment.