Hi there fellow adventurers,
I'm currently working on getting
distributed-process<http://hackage.haskell.org/package/distributed-process>
working
on iOS, and I'm running into some issues that I think are rooted in the
ghc-ios fork, rather than in the networking code that I've been puzzling
through. I'm making a call to Network.Socket.getAddrInfo, which does an FFI
call to getaddrinfo, the POSIX function. This function takes a double
pointer to a struct that it fills in with information about a network
address, and this struct contains a pointer to another struct. Here's where
things go awry: This nested pointer is intact and valid when the c function
(getaddrinfo) returns (I'm calling it from a wrapper function so I can
inspect the contents before we return to Haskell), but once Haskell gets
control-flow back, the nested pointer has been over-written, either with
NULL (usually) or a pointer to some faraway & invalid memory, either of
which cause EXC_BAD_ACCESS when haskell tries to #peek values out of the
nested struct.
Because I can see that the C function is completing successfully, and that
its pointers and contents are all valid before Haskell gets them, I suspect
that there is some underlying issue with the way iOS/ARM is handling the
pointers when they are returned to Haskell. I'm going to try to set up a
minimal repro tomorrow so I can investigate further, but in the meantime,
does anyone who has worked on implementing this ghc fork have a clue what
might be going wrong?
Thanks much,
Mike R
Hi there,
I'm experimenting with building Haskell into my Objective-C applications
via linking in the object files and _stub.h files along with the runtime
libraries*, so that I can build my haskell code along with my objC code
from XCode. However, I'm flummoxed because (as far as I can tell) I need a
libHSghc library to exist somewhere that's built for ARM, and I don't have
one. I asked in #ghc and was told that that library should be built
automatically when I run make, but I don't see it
in /usr/local/ghc-iphone/lib/ghc-7.5.20120619/ after I run make install.
There _is_ a ~/ghc/compiler/stage1/build/libHSghc-7.5.a (where ~/ghc is my
git repo) that gets built, so that's promising, but it's built for x64
instead of ARM.
Does anyone with more GHC-building experience know how I might configure my
build to get a libHSghc for ARM?
Mike
*As opposed to pre-building a static library of my haskell code + the
runtime and linking it in my XCode project.
PS I'm following the instructions on
https://github.com/ghc-ios/**ghc/wiki<https://github.com/ghc-ios/ghc/wiki>
to
build GHC.