Open zoujiaqing opened 3 months ago
dstep mysql.h
. It will output a corresponding D file mysql.d
.You can pass multiple files as well. You might need to add imports to the D files after running DStep. You might also need to pass some compiler flags to DStep. DStep accepts the same flags as Clang does.
See the readme as well:
https://github.com/jacob-carlborg/dstep?tab=readme-ov-file#usage
Thank you jacob!
Show error:
~/Downloads/dstep mysql.h -o mysql.d
dyld[59002]: missing symbol called
zsh: abort ~/Downloads/dstep mysql.h -o mysql.d
System info:
uname -a
Darwin mac 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64
For macOS you need to compile it yourself. There are build instructions in the readme [1]. I recommend using LLVM/libclang 15.0.7.
[1] https://github.com/jacob-carlborg/dstep?tab=readme-ov-file#building
I'll try to put out a new release, with precompiled binaries, but that might take a while.
Thank you!
mysql.d file has generated!
An warning has occurred:
% ./configure --llvm-path /opt/homebrew/Cellar/llvm@15/15.0.7
% dub build
% mv bin/dstep ~/bin/dstep
% cd ~/projects/test
% ~/bin/dstep mysql.h -o mysql.d
./field_types.h:54:6: warning: a type renamed to 'enum_field_types_' due to the collision with the symbol declared in ./field_types.h:94:31
step version:
% ~/bin/dstep --version
1.0.4-26-g5541229
I think that warning should be fine. It's printed due to there's an enum named enum_field_types
and a typedef with the same name. That's fine in C, since in C you need to explicitly include the enum
keyword when referring to an enum. But in D that's not the case.
BTW, there are several existing bindings to MySQL and PostgreSQL.
Thank you.