Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
162d1061
Commit
162d1061
authored
Apr 05, 2006
by
Simon Marlow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for ForeignPtrEnv
parent
821aa1fd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
testsuite/tests/ghc-regress/ccall/should_run/all.T
testsuite/tests/ghc-regress/ccall/should_run/all.T
+2
-0
testsuite/tests/ghc-regress/ccall/should_run/ffi016.hs
testsuite/tests/ghc-regress/ccall/should_run/ffi016.hs
+23
-0
testsuite/tests/ghc-regress/ccall/should_run/ffi016.stdout
testsuite/tests/ghc-regress/ccall/should_run/ffi016.stdout
+1
-0
No files found.
testsuite/tests/ghc-regress/ccall/should_run/all.T
View file @
162d1061
...
...
@@ -88,3 +88,5 @@ test('ffi014', only_ways(['threaded']), compile_and_run, ['ffi014_cbits.c'])
# GHCi can't handle the separate C file (ToDo: fix this somehow)
test
('
ffi015
',
omit_ways
(['
ghci
']),
compile_and_run
,
['
ffi015_cbits.c
'])
test
('
ffi016
',
normal
,
compile_and_run
,
[''])
testsuite/tests/ghc-regress/ccall/should_run/ffi016.hs
0 → 100644
View file @
162d1061
-- Tests ForeignPtrEnv finalizers
import
Text.Printf
import
Foreign.ForeignPtr
import
Foreign
import
GHC.TopHandler
import
Control.Concurrent
foreign
export
ccall
fin
::
Ptr
Int
->
Ptr
Int
->
IO
()
foreign
import
ccall
"&fin"
finptr
::
FinalizerEnvPtr
Int
Int
fin
::
Ptr
Int
->
Ptr
Int
->
IO
()
fin
envp
ap
=
runIO
$
do
env
<-
peek
envp
a
<-
peek
ap
printf
"%d %d
\n
"
env
a
return
()
main
=
do
a
<-
new
(
55
::
Int
)
env
<-
new
(
66
::
Int
)
fp
<-
newForeignPtrEnv
finptr
env
a
sum
[
1
..
1000000
]
`
seq
`
return
()
testsuite/tests/ghc-regress/ccall/should_run/ffi016.stdout
0 → 100644
View file @
162d1061
66 55
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment