May 09, 2014 Re: Any chance to avoid monitor field in my class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to flamencofantasy | flamencofantasy, thanx for that! Where do we vote here? =) |
May 13, 2014 Re: Any chance to avoid monitor field in my class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuriy | Moving further discussion to here: http://forum.dlang.org/thread/xpliectmvwrwthamquke@forum.dlang.org |
May 13, 2014 Re: Any chance to avoid monitor field in my class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuriy | "Yuriy" wrote in message news:uflaemdlxvavfmvkbudq@forum.dlang.org... > Hello, is there a way of reducing size of an empty class to just vtbl? I tried to declare it as extern(C++) which works, but has a nasty side effect of limited mangling. What exactly is the mangling problem with extern(C++) classes? |
May 13, 2014 Re: Any chance to avoid monitor field in my class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On Tuesday, 13 May 2014 at 17:09:01 UTC, Daniel Murphy wrote:
> What exactly is the mangling problem with extern(C++) classes?
Can't use D arrays (and strings) as function argument types.
Can't use D array types as template arguments.
extern (C++) MyClass(T)
{
}
MyClass!string a; // Mangling error
|
May 14, 2014 Re: Any chance to avoid monitor field in my class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuriy | On Tuesday, 13 May 2014 at 17:41:42 UTC, Yuriy wrote:
> On Tuesday, 13 May 2014 at 17:09:01 UTC, Daniel Murphy wrote:
>> What exactly is the mangling problem with extern(C++) classes?
> Can't use D arrays (and strings) as function argument types.
> Can't use D array types as template arguments.
>
> extern (C++) MyClass(T)
> {
>
> }
>
> MyClass!string a; // Mangling error
I'm not getting any errors with the development head. What os/compiler version?
|
May 14, 2014 Re: Any chance to avoid monitor field in my class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On Wednesday, 14 May 2014 at 08:47:38 UTC, Daniel Murphy wrote: > I'm not getting any errors with the development head. What os/compiler version? Hm, now that's strange. Building with latest public version seems to work. However, development head is doing the following: $ ./test.d Error: ICE: Unsupported type string Assertion failed: (0), function visit, file cppmangle.c, line 440. I'm using MacOS 10.9.2. The test.d is: http://dpaste.dzfl.pl/2aa4ca932be1 |
May 14, 2014 Re: Any chance to avoid monitor field in my class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuriy | On Tuesday, 13 May 2014 at 17:41:42 UTC, Yuriy wrote:
> On Tuesday, 13 May 2014 at 17:09:01 UTC, Daniel Murphy wrote:
>> What exactly is the mangling problem with extern(C++) classes?
> Can't use D arrays (and strings) as function argument types.
> Can't use D array types as template arguments.
>
> extern (C++) MyClass(T)
> {
>
> }
>
> MyClass!string a; // Mangling error
that should not compile at all. Perhaps you thought extern(C++) interface MyClass(T) ?
|
May 14, 2014 Re: Any chance to avoid monitor field in my class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dejan Lekic | On Wednesday, 14 May 2014 at 10:21:00 UTC, Dejan Lekic wrote: > that should not compile at all. Perhaps you thought extern(C++) interface MyClass(T) ? Ok, how about this one? http://dpaste.dzfl.pl/04655ff6ddfd It doesn't compile either. |
May 14, 2014 Re: Any chance to avoid monitor field in my class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuriy | On 05/14/2014 04:15 AM, Yuriy wrote: > On Wednesday, 14 May 2014 at 10:21:00 UTC, Dejan Lekic wrote: >> that should not compile at all. Perhaps you thought extern(C++) >> interface MyClass(T) ? > Ok, how about this one? > http://dpaste.dzfl.pl/04655ff6ddfd > It doesn't compile either. extern(C++) interface I { string hi(); } extern(C++) class A(T) : I { override string hi() { return "asdf"; } } void main() { A!string a; } /d208/f532.d(9): Error: class f532.A!(string).A cannot create C++ classes /d208/f532.d(19): Error: template instance f532.A!(string) error instantiating Yeah, that is a documented limitation when using C++ code. C++ templates cannot be used in D. "C++ Templates" here: http://dlang.org/cpp_interface.html Ali |
May 14, 2014 Re: Any chance to avoid monitor field in my class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | Ali, i think that paragraph is talking about another case, which is not my case. I'm not trying to use C++ templates, nor to export a D template to C++. Besides, i guess that D template, implementing a C++ interface is perfectly valid, regardless it's template arguments, since it is instantiated on the D side anyway. Also i guess that such types as D arrays should not support mangling when used as function arguments/rettype, they are not compatible with C++ anyway, but when they become part of a class template, they should mangle somehow. IMHO.
On Wednesday, 14 May 2014 at 14:08:52 UTC, Ali Çehreli wrote:
> Yeah, that is a documented limitation when using C++ code. C++ templates cannot be used in D. "C++ Templates" here:
>
> http://dlang.org/cpp_interface.html
>
> Ali
|
Copyright © 1999-2021 by the D Language Foundation