How to use D for cross platform development?

Jacob Carlborg doob at me.com
Thu Mar 29 05:10:16 PDT 2012


On 2012-03-29 11:12, Chris W. wrote:

> I cannot give you any advice as regards C++, because I have never really
> used it - avoiding it like the plague. My strategy is to keep things as
> simple as possible and use C only as the "glue". It's a bit like the Lua
> approach which only uses ANSI C to ensure maximum portability.
>
> Since I have just started to put the pieces together, I have yet to test
> whether it works on all platforms. I haven't tested it on Windows yet
> and don't know where the pitfalls are (and I am sure there are some!).
> It is amazing, though, how easily C code can be integrated into a D
> program. I have to use two external frameworks/libraries written in C
> (one of them the utf8proc library). With a few lines of code I've got
> all the functionality I need without writing any wrappers.
>
> I have not yet used Objective-C with D directly. Does anyone have
> experience with that?

I have some with using Objective-C together with D. It's a lot more 
verbose and quite more complicated than using a C library with D.

How complicated it is depends on what one want to do with the 
Objective-C library. Obviously one want to create Objective-C objects 
and call Objective-C methods. But if it's necessary to create subclasses 
in D and have Objective-C create instances of those classes and call 
methods on the objects it gets even more complicated.

I would recommend to have a look at Michel Fortin's fork of DMD which 
adds support for binding to Objective-C code directly, i.e. 
extern(Objective-C). Note that it's not 100% complete and based on an 
older version of DMD.

http://michelf.com/projects/d-objc/

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list