More automated interfacing of D with C codebases

Jacob Carlborg doob at me.com
Tue Oct 23 12:10:28 PDT 2012


On 2012-10-23 19:42, Brad Lanam wrote:

> I'm sorry, I don't see how that follows.  My scripts work on All
> variants of Linux (2.4, 2.6), Solaris (2.6 - 11), AIX, Tru64, HP-UX, All
> *BSD, Mac OSX, Haiku, QNX, SCO, Syllable, UnixWare, Windows Cygwin.  My
> 'di' program builds on all of the above with a simple 'make' as it uses
> my build tool.  And I don't need to install any special tools.  These
> are just the systems I have access to.

All of these don't use the same shell. Requiring to install bash would 
mean you do need to install special tools. Not really special but 
additional tools. But I would count Cygwin as a special tool for Windows.

> How is that not cross-platform?  How is that not portable?  How is that
> not easy?
>
> If I had a D compiler on all those platforms, the D version of the 'di'
> program would build everywhere with just a 'make'.
>
>>> If you need to write code that runs on multiple systems and works with
>>> low level system calls (rpc, et.al.), my tool might be a better choice.
>>
>> Why would that make a difference.
>
> Not all systems are alike.
>
>        static if (_c_args_setmntent == 1)
>        {
>          f = setmntent (toStringz(DI_MOUNT_FILE));
>        } else static if (_c_args_setmntent == 2) {
>          f = setmntent (toStringz(DI_MOUNT_FILE), toStringz("r"));
>        }
>
> If I understand your tool correctly, you might convert the mount.h or
> mntent.h file [but how does your program decide which one and even if
> they exist?].  But then how are you going to change your code to handle
> the above?  You've got a *lot* of work to do if you want a cross
> platform tool.
>
> I recommend SWIG+CMAKE.  Or my 'mkconfig' tool.

Well then, how does your tool work?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list