extern(C++, NS)

Manu via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 29 01:56:23 PST 2015


On 29 November 2015 at 19:42, Manu <turkeyman at gmail.com> wrote:
> On 29 November 2015 at 16:14, Manu <turkeyman at gmail.com> wrote:
>> Upon further wasting-my-time, I am starting to suspect the forward
>> referencing issue may be a bigger problem than it appears.
>> I have lots of aliases, and most of them work, but some of them just
>> don't; "Error: identifier 'Kernel' of 'ep.Kernel' is not defined" (not
>> a very helpful message). It is though, it's defined right next to it's
>> companion, which is declared at the same time, in the same place, but
>> I don't get an error for that one. I think the problem here is that
>> the companion symbol isn't involved in a cross-module reference.
>>
>> I try and reduce the problem, but it always disappears. It only
>> appears when the number of modules and interaction between them
>> becomes sufficient.
>> I suspect that whatever it is that causes namespace forward
>> referencing to fail may also be leading to this problem... just a
>> hunch, but it's the best I've got.
>
>
> Progress... now when I compile, I get a pop-up dialog box that says:
> "object.Error@(0): assert(0) or HLT instruction", and then writes
> "ICE: unsupported type const(char)[]" to the output.

So, I think this compiler crash is when trying to C++ mangle types
that it doesn't know how to deal with...
interestingly, one of those types is typeof(null), which should work,
and be mangled as nullptr_t ?
Any slice type (ie, char[]) used anywhere within any scope attributed
extern(C++) seems to cause DMD to crash.

I have these extern(C++) structs and classes, and within them are a
bunch of little D inline functions and helpers to make the C++ extern
useful to D.
This is where '[]' tends to appear, and the consequent compiler
crashes. I have tried: extern (D) void helperMethod(char[] s) { ... },
but extern(D) doesn't seem to do anything here, and it still crashes.
Options?


More information about the Digitalmars-d mailing list