[Guide] how to create c type bindings to koka #113
Replies: 4 comments 4 replies
-
@daanx After reading a bit the source of |
Beta Was this translation helpful? Give feedback.
-
I also created a benchmark for what we have got:
with
If this benchmark had no problem, we should be able to hash at speed P.S. |
Beta Was this translation helpful? Give feedback.
-
Awesome to see this. I agree, I need to write a C interface guide -- there is too much to do :-( I looked a bit but the code you wrote is too dependent on the how the compiler generates code.. You may look at the
without knowing about the internal representation. I will add a
Ah, lot of comments but I hope it helps -- Koka is still an early project so more work is needed here. |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm tacking onto this thread to get some help with c bindings. I am trying to bind the linenoise library but I get an error from the c compiler due to a missing declaration. helloworld.kk
linenoise-inline.c
c compiler errors:
So it seems like all the errors are being caused by a missing kk_linenoise declaration, and I checked the generated source code to see if that would give any further clues. What I found was that kk_linenoise was in fact not declared anywhere. When I copied the kk_linenoise into the generated c code, the error went away. So basically what I want to do is get the compiler to include kk_linenoise on its own if possible. I looked over a bunch of std library code and the comments above to get the code I have now, but I still seem to be missing something. Thank you all for the help! |
Beta Was this translation helpful? Give feedback.
-
Hi @daanx ,
I am testing porting https://github.com/SchrodingerZhu/ahash-c to koka, and I can write something like
with
However, there are still tons of things to do, like I must create APIs for allocation. And I begin to wonder whether there is a way to keep the things in value type in a third party library?
I see in the
kklib
thekk_integer_t
is actually specialized without a base wrapper; is it possible to create something like that out of the stdlib?Beta Was this translation helpful? Give feedback.
All reactions