Jump to page: 1 2
Thread overview
plans for interfacing to C++
Jan 09, 2012
Trass3r
Jan 09, 2012
Walter Bright
Jan 09, 2012
Zachary Lund
Jan 09, 2012
Walter Bright
Jan 09, 2012
Trass3r
Jan 09, 2012
deadalnix
Jan 09, 2012
Martin Nowak
Jan 09, 2012
Trass3r
Jan 09, 2012
Zachary Lund
Jan 09, 2012
Michel Fortin
Jan 09, 2012
Trass3r
Jan 10, 2012
deadalnix
Jan 10, 2012
sclytrack
Jan 10, 2012
Martin Nowak
Jan 10, 2012
Michel Fortin
Jan 10, 2012
Trass3r
Jan 10, 2012
Trass3r
January 09, 2012
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
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
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
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
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
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
>> 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
> 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
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
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/

« First   ‹ Prev
1 2