Thread overview | |||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 10, 2014 C++ interop - what to do about long and unsigned long? | ||||
---|---|---|---|---|
| ||||
C++'s long and unsigned long can be accessed with c_long and c_ulong. Unfortunately, these are aliases and mangle to their underlying types. Meaning that there is no way to interface to a C++ function declared as: void foo(unsigned long); So, what to do about this? 1. elevate c_long and c_ulong into full fledged types. 2. create full fledged types __c_long and __c_ulong, and alias c_long and c_ulong to them. 3. some sort of attribute? The same issue exists for C++'s 'long double'. |
September 10, 2014 Re: C++ interop - what to do about long and unsigned long? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright:
> 1. elevate c_long and c_ulong into full fledged types.
This looks like the simpler and cleaner solution. What are the disadvantages of this solution?
(In my opinion the C++ interop topic is way less important/urgent than designing and implementing the tracking/scoping of memory areas in D. So I am seeing a priority problem here).
Bye,
bearophile
|
September 10, 2014 Re: C++ interop - what to do about long and unsigned long? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Wednesday, 10 September 2014 at 20:41:45 UTC, Walter Bright wrote:
> 2. create full fledged types __c_long and __c_ulong, and alias c_long and c_ulong to them.
That's what I'd do. Should have best compatibility too with other definitions of c_long in third party libs.
|
September 10, 2014 Re: C++ interop - what to do about long and unsigned long? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 9/10/2014 2:08 PM, bearophile wrote:
> (In my opinion the C++ interop topic is way less important/urgent than designing
> and implementing the tracking/scoping of memory areas in D. So I am seeing a
> priority problem here).
Not inter-operating with C++ is turning out to be a huge barrier for D adoption.
|
September 10, 2014 Re: C++ interop - what to do about long and unsigned long? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | "bearophile" <bearophileHUGS@lycos.com> wrote:
> Walter Bright:
>
>> 1. elevate c_long and c_ulong into full fledged types.
>
> This looks like the simpler and cleaner solution. What are the disadvantages of this solution?
>
> (In my opinion the C++ interop topic is way less important/urgent than designing and implementing the tracking/scoping of memory areas in D. So I am seeing a priority problem here).
>
> Bye,
> bearophile
C++ interoperability: 1,000,000 merit points
Anything related to the GC: 999,999 merit points
All else: two digits merit points
|
September 10, 2014 Re: C++ interop - what to do about long and unsigned long? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Wednesday, 10 September 2014 at 21:08:30 UTC, bearophile wrote:
> (In my opinion the C++ interop topic is way less important/urgent than designing and implementing the tracking/scoping of memory areas in D. So I am seeing a priority problem here).
That would be nice, but C++ would be nicer. Not only does that really help in bringing D into existing code, it also makes things like using C++ libraries a lot easier. I'd enjoy access to Qt for example without needing 15 MB of wrapper code.
|
September 10, 2014 Re: C++ interop - what to do about long and unsigned long? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Wednesday, 10 September 2014 at 21:32:22 UTC, Andrei Alexandrescu wrote:
> "bearophile" <bearophileHUGS@lycos.com> wrote:
>> Walter Bright:
>>
>>> 1. elevate c_long and c_ulong into full fledged types.
>>
>> This looks like the simpler and cleaner solution. What are the
>> disadvantages of this solution?
>>
>> (In my opinion the C++ interop topic is way less important/urgent than
>> designing and implementing the tracking/scoping of memory areas in D. So
>> I am seeing a priority problem here).
>>
>> Bye,
>> bearophile
>
> C++ interoperability: 1,000,000 merit points
> Anything related to the GC: 999,999 merit points
> All else: two digits merit points
Not to go too far off topic, but C++ interoperability is at 0 merit points until you've got a GC-less standard library, finished shared library support on all platforms, and tools that rival those available for C++.
Clearly Walter and everyone should work on whatever they think is important. I hope your statement doesn't imply that all development effort is going to be put into C++ compatibility.
|
September 10, 2014 Re: C++ interop - what to do about long and unsigned long? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bachmeier | On 9/10/2014 4:16 PM, bachmeier wrote:
> Not to go too far off topic, but C++ interoperability is at 0 merit points until
> you've got a GC-less standard library, finished shared library support on all
> platforms, and tools that rival those available for C++.
If that were true, then D interoperability with C would be impossible as well. But it is possible and works well.
|
September 11, 2014 Re: C++ interop - what to do about long and unsigned long? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bachmeier | On 9/10/14, 4:16 PM, bachmeier wrote: > Not to go too far off topic, but C++ interoperability is at 0 merit > points until you've got a GC-less standard library, finished shared > library support on all platforms, and tools that rival those available > for C++. No. C++ interop and GC are related, but only loosely. > Clearly Walter and everyone should work on whatever they think is > important. I hope your statement doesn't imply that all development > effort is going to be put into C++ compatibility. Ideally it would. Andrei |
September 11, 2014 Re: C++ interop - what to do about long and unsigned long? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Thursday, 11 September 2014 at 00:29:37 UTC, Andrei Alexandrescu wrote:
> On 9/10/14, 4:16 PM, bachmeier wrote:
>> Clearly Walter and everyone should work on whatever they think is
>> important. I hope your statement doesn't imply that all development
>> effort is going to be put into C++ compatibility.
>
> Ideally it would.
>
>
> Andrei
It's scaring that all the efforts are now focused on that.
I'm curious to understand the plan for interop with not-virtual class methods: OpenCV for example.
--
/Paolo
|
Copyright © 1999-2021 by the D Language Foundation