In my project i have 2 C libraries as dependency
It is annoying because my project is crossplatform, so i have to maintain build scripts for all platform.. and then i have to make sure the bindings with all the structs/externs are up to date..
So i decided to stop doing that and instead give ImportC a try, and so far... so good! I managed to remove one dependency already! I'm now working on removing the 2nd one (i got it to build on linux, i will have to test for windows)
There was few problems i had to workaround
typedef unsigned __int32 size_t;
typedef unsigned __int64 size_t;
__declspec(noreturn)
They refused to compile, i i had to come up with these defines as a workaround until it gets fixed (i reported the issues on the bug tracker)
workaround:
#define __int32 int
#define __int64 long
#define __declspec(noreturn)
There was also a member of a struct named: null
, we can't use that in D, so i had to rename it (i will send a PR to the libraries repo, because 'null' is a bad name anyways :p)
And tadaa, it compiles, and it works!!
My renderer code in D (opengl stuff): https://gist.github.com/ryuukk/1c8b7af3265389ed94467bef2fd70d30
It calls directly into the nuklear.c module!
Thanks Walter for working on ImportC, it already is super useful, and i encourage everyone to try on their favorite library and report issues they encounter (and successes) to make ImportC even better!
After testing, next up i'll post about the next library, https://github.com/cesanta/mongoose