(cc-ing to the mailing list)
btw, I was wondering do you have any ideas why passing the Addr type to show results in a segmentation fault while there actually is a implementation in the C. ( never seen C code like that tho).
I don’t know, I’ll check it out.
I looked into this. It turns out it wasn’t possible to use ‘Addr’ from the source language, so I assume you were calling the show function from Core Salt instead. If that is true then you’ll need to show me the example that crashes.
I just added the ability to use ‘Addr’ from Discus code, so the following works.
Ben.
module Main
import System.IO.Console
import foreign abstract type
Mem : Effect
import foreign c value
malloc : Nat# -> S Mem Addr#
free : Addr# -> S Mem Void#
where
main ()
= constant r in
do addr = malloc 100
writel $ show addr
free addr
()