Thread overview | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 09, 2012 plans for interfacing to C++ | ||||
---|---|---|---|---|
| ||||
There were some discussions about adding namespace support with something like extern(C++, namespace) IIRC. Don't know the result though. Then there's this small patch (http://d.puremagic.com/issues/show_bug.cgi?id=4620) which allows very interesting stuff, even simple templates. It's rotting. So what are the current plans? Not being able to access C++ libraries directly is a real blocker. We should really try to improve the situation. |
January 09, 2012 Re: plans for interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | On 1/8/2012 7:54 PM, Trass3r wrote: > There were some discussions about adding namespace support with something like > extern(C++, namespace) IIRC. Don't know the result though. > > Then there's this small patch > (http://d.puremagic.com/issues/show_bug.cgi?id=4620) which allows very > interesting stuff, even simple templates. It's rotting. Wanna do a pull request for it? > So what are the current plans? > Not being able to access C++ libraries directly is a real blocker. We should > really try to improve the situation. I'm working as fast as I can :-) |
January 09, 2012 Re: plans for interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | How would this work exactly? Especially on Windows, libraries tend to not be compatible with each other. Will a C++ library be required to be compiled and linked with a certain toolset?
On 01/09/2012 03:16 AM, Walter Bright wrote:
> On 1/8/2012 7:54 PM, Trass3r wrote:
>> There were some discussions about adding namespace support with
>> something like
>> extern(C++, namespace) IIRC. Don't know the result though.
>>
>> Then there's this small patch
>> (http://d.puremagic.com/issues/show_bug.cgi?id=4620) which allows very
>> interesting stuff, even simple templates. It's rotting.
>
> Wanna do a pull request for it?
>
>> So what are the current plans?
>> Not being able to access C++ libraries directly is a real blocker. We
>> should
>> really try to improve the situation.
>
> I'm working as fast as I can :-)
|
January 09, 2012 Re: plans for interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | Le 09/01/2012 04:54, Trass3r a écrit :
> There were some discussions about adding namespace support with
> something like extern(C++, namespace) IIRC. Don't know the result though.
>
> Then there's this small patch
> (http://d.puremagic.com/issues/show_bug.cgi?id=4620) which allows very
> interesting stuff, even simple templates. It's rotting.
>
> So what are the current plans?
> Not being able to access C++ libraries directly is a real blocker. We
> should really try to improve the situation.
I was npot aware of this existing. This is awesome.
|
January 09, 2012 Re: plans for interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zachary Lund | On 1/9/2012 1:25 AM, Zachary Lund wrote:
> How would this work exactly? Especially on Windows, libraries tend to not be
> compatible with each other. Will a C++ library be required to be compiled and
> linked with a certain toolset?
Yes, as it is already.
|
January 09, 2012 Re: plans for interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | Am 09.01.2012, 04:54 Uhr, schrieb Trass3r <un@known.com>:
> There were some discussions about adding namespace support with something like extern(C++, namespace) IIRC. Don't know the result though.
>
> Then there's this small patch (http://d.puremagic.com/issues/show_bug.cgi?id=4620) which allows very interesting stuff, even simple templates. It's rotting.
>
> So what are the current plans?
> Not being able to access C++ libraries directly is a real blocker. We should really try to improve the situation.
IMHO this patch is rather flawed
- Don't construct C++ classes as value types.
You would need to know the exact size of the type
and D can't preserve semantics for copy and assign.
- D and C++ templates don't really map.
|
January 09, 2012 Re: plans for interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | >> Then there's this small patch >> (http://d.puremagic.com/issues/show_bug.cgi?id=4620) which allows very >> interesting stuff, even simple templates. It's rotting. > > Wanna do a pull request for it? Just wanted to point at it. I'd like to have some discussion. See Martin Nowak's post for example. In the end we need a consistent way to interface with C++. >> So what are the current plans? >> Not being able to access C++ libraries directly is a real blocker. We should >> really try to improve the situation. > > I'm working as fast as I can :-) I do believe that :) |
January 09, 2012 Re: plans for interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | > There were some discussions about adding namespace support with something like extern(C++, namespace) IIRC. Don't know the result though.
Hmm another difficulty is how to switch between mangling schemes.
|
January 09, 2012 Re: plans for interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | On 01/09/2012 06:36 AM, Trass3r wrote:
>> There were some discussions about adding namespace support with
>> something like extern(C++, namespace) IIRC. Don't know the result though.
>
> Hmm another difficulty is how to switch between mangling schemes.
Given Walter's comment, I don't think they plan to.
|
January 09, 2012 Re: plans for interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | On 2012-01-09 12:36:35 +0000, Trass3r <un@known.com> said: >> There were some discussions about adding namespace support with something like extern(C++, namespace) IIRC. Don't know the result though. > > Hmm another difficulty is how to switch between mangling schemes. One thing that could be done is instead of the namespace argument, have a mangled name argument. Then use CTFE to build the mangled name (if you want to). This would also solve the problem we have on OS X where some C functions use a mangled name with a '$' in them thanks to the use of some GCC attribute in the system headers. Or maybe it should be a pragma instead. -- Michel Fortin michel.fortin@michelf.com http://michelf.com/ |
Copyright © 1999-2021 by the D Language Foundation