git.iko.soy
/
Idris-dev
readme
files
commits
refs
on
master
help
sign in
Null pointer FFI test
2c31e8e
Edward Amsden
13 years ago
test/test033/expected
new file
+1
compare with master
unified
split
@@ -0,0 +1 @@
1
+
0
test/test033/run
new file
+5
@@ -0,0 +1,5 @@
1
+
#!/bin/bash
2
+
gcc -c test033.c
3
+
idris -o test033 test033.idr
4
+
./test033
5
+
rm -f *.ibc *.o test033
test/test033/test033.c
new file
+10
@@ -0,0 +1,10 @@
1
+
#include
"test033.h"
2
+
#include
<stddef.h>
3
+
4
+
int testNull(void* p) {
5
+
if
(p ==
NULL
) {
6
+
return
0
;
7
+
}
8
+
return
1
;
9
+
}
10
+
test/test033/test033.h
new file
+6
@@ -0,0 +1,6 @@
1
+
#ifndef
__TEST033_H__
2
+
#define
__TEST033_H__
3
+
4
+
int testNull(void*);
5
+
6
+
#endif
test/test033/test033.idr
new file
+10
@@ -0,0 +1,10 @@
1
+
module Main
2
+
3
+
%include C "test033.h"
4
+
%link C "test033.o"
5
+
6
+
testNull : Ptr -> IO Int
7
+
testNull p = mkForeign (FFun "testNull" [FPtr] FInt) p
8
+
9
+
main : IO ()
10
+
main = testNull null >>= (putStrLn . show)
keys
esc to close
j k
move down, up
enter
open
esc
back, or up a level
1 2 3 4
readme, files, commits, refs
/
filter
y
copy the clone command
c
compare the chosen commit with another (or shift-click both)
?
show or hide this list