-
-
Save anonymous/efaa43dc9104a2c2ff43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context: I have a program with a variant type named "value". ( See here: https://gist.github.com/anonymous/6390fa6d9cb0de2c5ef3 ). I want to find a way of taking a dynamically constructed definition of a C function, then loading that C function using CTypes "foreign" and wrapping the result with a converter function that would, for example, translate an int->string->int to a value->value->value. | |
This is a working implementation of what I want with 2 arguments. The code: | |
https://bitbucket.org/runhello/test-emily-game/src/e1cac5bf0546234ab7b69977b53625efaef7d8d7/src/internalPackage.ml?at=default | |
When I start moving to more than 2 arguments-- before I even get more than 2 arguments working!-- I find something I don't understand involving existential types. The code: | |
https://bitbucket.org/runhello/test-emily-game/src/6ea499b99d92f1f507e95d3eee7ebdc2fd4244ab/src/internalPackage.ml?at=default | |
When I compile this, I get this error message. I don't understand it. My question: Why is cReturnType expected? | |
Andis-Macbook:test-emily-game mcc$ makeocamlbuild -no-links -use-ocamlfind src/main.native.o | |
Finished, 0 targets (0 cached) in 00:00:00. | |
+ ocamlfind ocamlc -c -safe-string -package 'ctypes, ctypes.foreign' -package 'sedlex, containers, fileutils, ppx_getenv, ppx_const, uutf' -I src -o src/internalPackage.cmo src/internalPackage.ml | |
File "src/internalPackage.ml", line 63, characters 28-58: | |
Error: This expression has type cChainedReturnType#0 | |
but an expression was expected of type cReturnType#0 | |
Command exited with code 2. | |
Compilation unsuccessful after building 22 targets (21 cached) in 00:00:00. | |
make: *** [_build/src/main.native.o] Error 10 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment