Seg fault when calling C code
Andrew Brown via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 16 08:15:36 PDT 2014
On Friday, 16 May 2014 at 14:52:17 UTC, Marc Schütz wrote:
> On Friday, 16 May 2014 at 11:42:35 UTC, Kagamin wrote:
>> For example, windows headers do use C++ &-references in
>> function signatures and msdn provides code examples using that
>> convention, the equivalent in D is ref.
>
> But that's extern(C++), not extern(C)...
I guess my confusion came about because in the page about
interfacing with C, there's a static array example where
parameters are given in terms D understands:
extern (C)
{
void foo(ref int[3] a); // D prototype
}
I guess D has no problem translating that into a simple pointer
that C can deal with. I assumed the same would be true of dynamic
arrays, but maybe the leap is too far?
More information about the Digitalmars-d-learn
mailing list