Is it correct?
When I wrote next code:
template Extern(string s)
{
mixin("static extern(C) extern int "~s~";"~
"alias Extern = "~s~";");
}
void main()
{
writeln(&Extern!("xxx"));
}
I get error message "undefined reference to
`_D1a24__T6ExternVAyaa3_787878Z3xxxi'", when I expect to get
May be I need to fix that issue? What about functions?
struct Foo
{
extern(C) void bar()
{
}
}
Is it good to set bar mangling to "bar"?
On 5/7/13, Igor Stepanov wrote:
> struct Foo
> {
>extern(C) void bar()
>{
>
>}
> }
>
> Is it good to set bar mangling to "bar"?
No. For one example, internal extern(C) functions can be used for
callbacks. You wouldn't want linking to fail if you have this code:
struct A
{
extern(
On Wednesday, 8 May 2013 at 09:09:34 UTC, Andrej Mitrovic wrote:
...
Suck code is invalid in C++ and for a good reason. I'd really
expect D to refuse to compile extern(C) functions it can't
possibly mangle correctly.
On 5/8/13, Dicebot wrote:
> On Wednesday, 8 May 2013 at 09:09:34 UTC, Andrej Mitrovic wrote:
>> ...
>
> Suck code is invalid in C++ and for a good reason. I'd really
> expect D to refuse to compile extern(C) functions it can't
> possibly mangle correctly.
>
Sorry, I forgot I was actually thinking
On Wednesday, 8 May 2013 at 09:22:52 UTC, Andrej Mitrovic wrote:
On 5/8/13, Dicebot wrote:
On Wednesday, 8 May 2013 at 09:09:34 UTC, Andrej Mitrovic
wrote:
...
Suck code is invalid in C++ and for a good reason. I'd really
expect D to refuse to compile extern(C) functions it can't
possibly ma
On 5/8/13, Dicebot wrote:
> static methods are illegal in C++ with extern(C) too.
I don't see why. They're useful in D anyway.
On Wednesday, 8 May 2013 at 09:46:00 UTC, Andrej Mitrovic wrote:
On 5/8/13, Dicebot wrote:
static methods are illegal in C++ with extern(C) too.
I don't see why. They're useful in D anyway.
Because they have namespace (class namespace) and can't be
mangled according to C rules. Exactly you
On 5/8/13, Dicebot wrote:
> Because they have namespace (class namespace) and can't be
> mangled according to C rules. Exactly your example. You can't
> have two "foo"'s there but any other naming scheme IS NOT C
> mangling but some weird abomination that pretends to be it. Thus
> it is a compile-
On Wednesday, 8 May 2013 at 09:56:14 UTC, Andrej Mitrovic wrote:
On 5/8/13, Dicebot wrote:
Because they have namespace (class namespace) and can't be
mangled according to C rules. Exactly your example. You can't
have two "foo"'s there but any other naming scheme IS NOT C
mangling but some weird
On 5/8/13, Dicebot wrote:
> Well, that is one of rather inconvenient issues with D handling
> of emitting symbols (this one kind of inherited from C++).
> extern(X) defines both mangling and calling convention. You can't
> have those separately now.
Yeah.
I suppose the ideal situation would be t
On Wednesday, 8 May 2013 at 10:28:40 UTC, Andrej Mitrovic wrote:
I suppose the ideal situation would be to have extern(C) follow
strict
C mangling and calling convention (meaning no mangling for
nested
extern(C) symbols), and have a separate linkage(C) feature to
be used
when we want to set the
On 5/8/13, Dicebot wrote:
> Well, pardon me, I probably have exceeded my allowed daily rant
> limit :)
Don't worry, and I agree with you. But I think it's probably too late
to actually change what a linkage specifier does for nested symbols.
We might end up getting duplicate symbol definition err
On Wednesday, 8 May 2013 at 19:14:14 UTC, Andrej Mitrovic wrote:
On 5/8/13, Dicebot wrote:
Well, pardon me, I probably have exceeded my allowed daily rant
limit :)
Don't worry, and I agree with you. But I think it's probably
too late
to actually change what a linkage specifier does for neste
14 matches
Mail list logo