Feature request: direct support for ccalls (like ghcjs)
jneira opened this issue · 1 comments
jneira commented
Description
- eta doesn't support
foreign import ccall
so we have to patch the code replacing them withforeign import java
ghcjs
supports them converting the ccall calling a javascript function using a name convention: https://github.com/ghcjs/ghcjs/blob/master/doc/foreign-function-interface.md#emulating-c-code-with-foreign-import-ccall- patching packages would be easier cause in many cases we only would need to add
java-sources
with the appropiate classes and methods
Expected Behavior
- eta should translate
foreign import ccall
generating java calls to class eta.. ( f.e. eta.unix.SystemPosixFiles) and method (rename) - maybe we could (de)activate the behaviour with a flag
- maybe we could make a tool (integrated in eta/etlas?) to generate auto java stubs with all ccalls of a package using this name convention
Actual Behavior
- eta rejects
foreign import ccall
rahulmutt commented
I like the GHCJS approach. It's a bit implicit, but I think it's OK. The only issue I can see is that a lot of times you need to replace Ptr
with a Java object and the actual type signatures change. In the other cases it would be OK.