Re: Interfacing D with C and C++

2014-08-26 Thread Walter Bright via Digitalmars-d
On 8/23/2014 3:46 PM, Scott Wilson wrote: 1. What is the current support for calling C/C++ free functions from D? What level of mangling is supported? What data types can be passed without translation from D to C/C++? D's native types can be used to call C/C++ free functions directly without t

Re: Interfacing D with C and C++

2014-08-24 Thread Kagamin via Digitalmars-d
Looks like std::allocator got reduced to just Sa. What a hack.

Re: Interfacing D with C and C++

2014-08-23 Thread ketmar via Digitalmars-d
On Sun, 24 Aug 2014 05:15:14 + Scott Wilson via Digitalmars-d wrote: > The D code is not instantiating (but I may be wrong). sorry, it was my fault. i somehow misread your code. signature.asc Description: PGP signature

Re: Interfacing D with C and C++

2014-08-23 Thread Scott Wilson via Digitalmars-d
The D code is not instantiating (but I may be wrong). I think writing template struct allocator; on the C++ side instantiates and the D code only links with that instantiation. I reckon I'm out of my depth here. Scott On Sunday, 24 August 2014 at 04:47:38 UTC, ketmar via Digitalmars-d wrote:

Re: Interfacing D with C and C++

2014-08-23 Thread Scott Wilson via Digitalmars-d
On Sunday, 24 August 2014 at 04:59:04 UTC, Walter Bright wrote: On 8/23/2014 9:31 PM, Scott Wilson wrote: Could you tell me how I could get this to work? The function is mangled as: C++:_ZNSaIiE10deallocateEPvm D: _ZN3std9allocatorIiE10deallocateEPvm Looks like D gets it wrong. Th

Re: Interfacing D with C and C++

2014-08-23 Thread Walter Bright via Digitalmars-d
On 8/23/2014 9:31 PM, Scott Wilson wrote: Could you tell me how I could get this to work? The function is mangled as: C++:_ZNSaIiE10deallocateEPvm D: _ZN3std9allocatorIiE10deallocateEPvm Looks like D gets it wrong.

Re: Interfacing D with C and C++

2014-08-23 Thread ketmar via Digitalmars-d
On Sun, 24 Aug 2014 04:31:55 + Scott Wilson via Digitalmars-d wrote: there is NO support for instantiating C++ templates in D code. and you can't write C++ template specialization code in D. signature.asc Description: PGP signature

Re: Interfacing D with C and C++

2014-08-23 Thread Scott Wilson via Digitalmars-d
Thank you all for responding. I have run the following experiment. Trying to call a method of std::allocator I am sure I am doing something wrong. Please do tell and apologies for my noobiness. // test.d extern(C++, std) { struct allocator(T) { alias size_type = size_t;

Re: Interfacing D with C and C++

2014-08-23 Thread bachmeier via Digitalmars-d
On Saturday, 23 August 2014 at 22:46:11 UTC, Scott Wilson wrote: Hello, world. Brand new poster here though I posted similar messages in other language forums. I hope this is the right place to ask because my question is half about existing stuff and half about prospective work. I am consider

Re: Interfacing D with C and C++

2014-08-23 Thread Peter Alexander via Digitalmars-d
Welcome! 1. What is the current support for calling C/C++ free functions from D? What level of mangling is supported? What data types can be passed without translation from D to C/C++? 3. How can a C++ object be used from D? Can C++ methods be called from D? The question applies to value typ

Interfacing D with C and C++

2014-08-23 Thread Scott Wilson via Digitalmars-d
Hello, world. Brand new poster here though I posted similar messages in other language forums. I hope this is the right place to ask because my question is half about existing stuff and half about prospective work. I am considering starting with D amid a C++ code base. New D code would need t