On 2020-12-16 16:18, Dave P. wrote:
Is this a bug in the spec or in the implementation?
Yeah, that's a good question. That's always problematic with D. The spec
is incomplete.
How do we get this fixed?
The simplest would be to change the spec.
--
/Jacob Carlborg
On Wednesday, 16 December 2020 at 06:46:42 UTC, Jacob Carlborg
wrote:
On Wednesday, 16 December 2020 at 04:17:13 UTC, Mike Parker
wrote:
However, the D calling convention is defined to be identical
to the C calling convention on the host system for everything
except Windows x86.
That's
On Wednesday, 16 December 2020 at 04:17:13 UTC, Mike Parker wrote:
So what you're asking for is a way to retain the D name
mangling on an extern C function. The way to do that is with
`pragma(mangle, "new_name")`. To match the original D function
mangling, declare the function fir
On Wednesday, 16 December 2020 at 04:17:13 UTC, Mike Parker wrote:
However, the D calling convention is defined to be identical to
the C calling convention on the host system for everything
except Windows x86.
Also keep in mind that D supports other types than C does, like D
arrays and
On Wednesday, 16 December 2020 at 04:17:13 UTC, Mike Parker wrote:
However, the D calling convention is defined to be identical to
the C calling convention on the host system for everything
except Windows x86.
That's what's specified, but that's not how DMD actually behaves.
DMD passes the
On Wednesday, 16 December 2020 at 04:45:34 UTC, Dave P. wrote:
Oh interesting, so I only need extern(C) for declaring symbols
I’m linking to and
for symbols I want to export to C. I had sort of assumed that D
might have
different calling conventions for different things, but that
makes
to the
leading underscore.
So what you're asking for is a way to retain the D name
mangling on an extern C function. The way to do that is with
`pragma(mangle, "new_name")`. To match the original D function
mangling, declare the function first without extern(C) and
print `func.mang
On 12/15/20 2:04 PM, Dave P. wrote:
> I want to pass
> some templated functions as function pointers to some C code
As Mike Parker said, it works:
// The same thing as a C function pointer:
alias Func = long function(int);
long bar(T)(int) {
return 0;
}
Func f0 = &(bar!float);
Func d1 =
On Tuesday, 15 December 2020 at 22:04:12 UTC, Dave P. wrote:
I can’t find this in the spec, but from experimentation it
seems like extern(C) only affects name mangling of functions at
the top level scope. Thus extern(C) function templates would be
mangled differently, but still use the C
I can’t find this in the spec, but from experimentation it seems
like extern(C) only affects name mangling of functions at the top
level scope. Thus extern(C) function templates would be mangled
differently, but still use the C calling convention. Is this
right? I want to pass some templated
10 matches
Mail list logo