Will I try again? and also C header files.
Rémy Mouëza
remy.moueza at gmail.com
Fri May 31 14:08:31 PDT 2013
Concerning dstep,
I compiled it recently (Ubuntu 12.04 32 bits system) and it wasn't as
straightforward as it was described in the README file, nor was it that
complicated to have it work. I'll outline my experience below for those
interested.
first step that needed some care was the compilation of Tango-D2: I
downloaded the last version that did not compiled on dmd 2.060 but did
well on dmd 2.061 (and fast).
When I got dstep compiled, I forgot to run `sudo ldconfig` so that dstep
could find libclang.so (this is not a bug nor an annoyance but it may be
confusing at first).
Then, (dstep or rather) clang stopped with an error telling me it could
not find "stddef.h". A quick google search seemed to indicate that I
needed to upgrade from llvm-3.1 to llvm-3.2 to automagically solve that
problem.
However, what I really had to do was to find out the include path which
on my system is :
/usr/local/include
/usr/include
/usr/include/i386-linux-gnu/
/home/ray/apps/llvm-3.2/include/clang/ # wherever is installed
llvm/clang
/usr/lib/gcc/i686-linux-gnu/4.6/include/
/usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/
So I ran dstep like this:
$ ~/dev/dee/dstep/bin/dstep mongoose.h -o mongoose_d.d -v
-I/usr/local/include -I/usr/include -I/usr/include/i386-linux-gnu/
-I/home/ray/apps/llmv-3.2/include/clang
-I/usr/lib/gcc/i686-linux-gnu/4.6/include/
-I/usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/
I noticed in the output file that an embedded "typedef'ed" struct was
not handled very well but fixing this manually went really quick.
Using the output, my Mongoose test program no longer crashes with
segfaults due to a mysterious void *user_data pointer being always set
to 0x4 in my callback function even when set otherwise at initialization.
In brief: dstep is a huge improvement over manually writing a D header
interface.
As for IUP, since I happen to have iup.h on my system, I tried it with
dstep. The command line had just to be adjusted, adding the path to the
include directory like '-I/path/to/iup/include/dir' or '-I`pwd`' when
generating directly within the directory.
On 05/31/2013 10:52 AM, Jacob Carlborg wrote:
> On 2013-05-31 09:18, SeanVn wrote:
>> I looked at the D programming language a few years ago and though it was
>> good. Then I ran into trouble. The language was in a state of flux. I
>> would write code and with the next version of D it would no longer
>> work. The same thing was happening to people who were writing tools
>> such as IDE's for D and I guess most of them just gave up.
>> That was then.
>> I hope now things have settled down. I will look at the language for a
>> couple of days. I presume I now only have to look at D2 and Phobos and
>> not the previous 4 way split of D1/D2/Phobos/Tango.
>> I have a specific engineering application I want to develop. I want to
>> pick a programming language that will give me the cleanest and most
>> maintainable code possible. I want to use the IUP GUI library. That is
>> a shared library that has C headers. I presume I will be able to call
>> the dll functions easily in D2? Maybe I will only have to make some
>> minimal changes to the C header files to get them to work with D2?
>
> You need to convert the C header files to D modules. Or the actual
> declarations you want to use. There's a tool available to do that:
>
> https://github.com/jacob-carlborg/dstep
>
More information about the Digitalmars-d
mailing list