Optlink is on github

Johannes Pfau nospam at example.com
Sat Mar 9 02:31:29 PST 2013


Am Sat, 09 Mar 2013 10:32:18 +0100
schrieb "Dicebot" <m.strashun at gmail.com>:

> On Saturday, 9 March 2013 at 09:11:54 UTC, Johannes Pfau wrote:
> > Am Thu, 07 Mar 2013 19:53:29 +0400
> > schrieb Denis Shelomovskij <verylonglogin.reg at gmail.com>:
> >
> >> 07.03.2013 14:28, Jacob Carlborg пишет:
> >> > On 2013-03-07 11:12, Moritz Maxeiner wrote:
> >> >
> >> >> Sorry if this has been answered before/is common knowledge, 
> >> >> but is
> >> >> porting functions at a time to C wanted for optlink in 
> >> >> general, or
> >> >> only for finding segfaults? (e.g. are pull-requests for that
> >> >> welcome)
> >> >
> >> > Yes, in general. I think the idea is to port the whole 
> >> > Optlink to C
> >> > and then to D. It's easier to port from C to D than from 
> >> > assembly
> >> > to D. This is because you can use a C version that doesn't 
> >> > use the
> >> > runtime or standard library to get the generate assembly as 
> >> > close
> >> > as possible to the original one. I think it was something 
> >> > like that.
> >> >
> >> 
> >> Didn't get. You don't have to use D with druntime. Just don't 
> >> link it and everything will be OK - you will just get "better 
> >> C" (i.e. with D structs and other good stuff).
> >> 
> >
> > That's a little bit oversimplified. Even a simple POD struct 
> > references
> > the TypeInfo_Struct declaration in druntime. There's still some
> > compiler work needed to really make D usable without druntime. 
> > (Think
> > of issues like these: If you don't have druntime -> you don't 
> > have
> > typeinfo -> no D style varargs -> no associative arrays; you 
> > can't even
> > compare normal arrays 
> > (https://github.com/D-Programming-Language/druntime/blob/e47a00bff935c3f079bb567a6ec97663ba384487/src/rt/adi.d#L368))
> 
> It can be easily checked with "-betterC -defaultlib=" combo. You 
> can skip phobos, druntime, use only C stdlib and look what will 
> remain working in the language. Not much.

I know that, I've run D code on the DS without druntime and on
Android as well, but betterC only disables moduleinfo, not typeinfo. So
you don't even get structs without druntime and that is certainly not
better than C.

test.d:
-------
struct A
{
}
-------

dmd -betterC -defaultlib= -c test.d
nm test.o
U _D15TypeInfo_Struct6__vtblZ



More information about the Digitalmars-d mailing list