Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-29 Thread kinke via Digitalmars-d-learn
On Saturday, 29 April 2017 at 18:54:36 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: But still, this needs to be fixed, copy pasting the name mangling is in my opinion just a hack for your specific cpp compiler on your specific platform. It can't be fixed on the D side as the Visual C++

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-29 Thread via Digitalmars-d-learn
On Saturday, 29 April 2017 at 08:08:27 UTC, ParticlePeter wrote: On Saturday, 29 April 2017 at 00:31:32 UTC, Nicholas Wilson wrote: If you are having problems with the linker with Ali's you can do ``` extern(C++) bool cppFunc( float[3] color ); // correct signature, but causes compiler

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-29 Thread ParticlePeter via Digitalmars-d-learn
On Saturday, 29 April 2017 at 10:17:47 UTC, Atila Neves wrote: On Saturday, 29 April 2017 at 06:22:03 UTC, ParticlePeter wrote: On Saturday, 29 April 2017 at 01:49:56 UTC, Atila Neves wrote: On Friday, 28 April 2017 at 18:41:22 UTC, kinke wrote: [...] The worst part about that is mangling

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-29 Thread Atila Neves via Digitalmars-d-learn
On Saturday, 29 April 2017 at 06:22:03 UTC, ParticlePeter wrote: On Saturday, 29 April 2017 at 01:49:56 UTC, Atila Neves wrote: On Friday, 28 April 2017 at 18:41:22 UTC, kinke wrote: [...] The worst part about that is mangling aside, the two declarations are identical to the compiler.

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-29 Thread ParticlePeter via Digitalmars-d-learn
On Saturday, 29 April 2017 at 00:31:32 UTC, Nicholas Wilson wrote: If you are having problems with the linker with Ali's you can do ``` extern(C++) bool cppFunc( float[3] color ); // correct signature, but causes compiler error pragma(mangle, cppFunc.mangleof) float cppFunc(float * color);

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-29 Thread ParticlePeter via Digitalmars-d-learn
On Saturday, 29 April 2017 at 01:49:56 UTC, Atila Neves wrote: On Friday, 28 April 2017 at 18:41:22 UTC, kinke wrote: On Friday, 28 April 2017 at 18:07:49 UTC, ParticlePeter wrote: Interesting, your example corresponds to my third case, the linker error. I am on Window, building an x64 App,

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread Atila Neves via Digitalmars-d-learn
On Friday, 28 April 2017 at 18:41:22 UTC, kinke wrote: On Friday, 28 April 2017 at 18:07:49 UTC, ParticlePeter wrote: Interesting, your example corresponds to my third case, the linker error. I am on Window, building an x64 App, afaik in that case the MS Visual Studio linker is used instead of

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 28 April 2017 at 19:08:18 UTC, ParticlePeter wrote: On Friday, 28 April 2017 at 17:57:34 UTC, Ali Çehreli wrote: On 04/28/2017 08:56 AM, ParticlePeter wrote: > C++ Function: > bool cppFunc( float[3] color ); > > D binding: > extern(C++) bool cppFunc( float[3] color ); > > Using with:

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread ParticlePeter via Digitalmars-d-learn
On Friday, 28 April 2017 at 17:57:34 UTC, Ali Çehreli wrote: On 04/28/2017 08:56 AM, ParticlePeter wrote: > C++ Function: > bool cppFunc( float[3] color ); > > D binding: > extern(C++) bool cppFunc( float[3] color ); > > Using with: > float[3] my_color; > cppFunc( my_color ); > > -> Error:

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread kinke via Digitalmars-d-learn
On Friday, 28 April 2017 at 18:07:49 UTC, ParticlePeter wrote: Interesting, your example corresponds to my third case, the linker error. I am on Window, building an x64 App, afaik in that case the MS Visual Studio linker is used instead of optilink. Will add your findings to the bug report.

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread ParticlePeter via Digitalmars-d-learn
On Friday, 28 April 2017 at 17:57:34 UTC, Ali Çehreli wrote: On 04/28/2017 08:56 AM, ParticlePeter wrote: > C++ Function: > bool cppFunc( float[3] color ); > > D binding: > extern(C++) bool cppFunc( float[3] color ); > > Using with: > float[3] my_color; > cppFunc( my_color ); > > -> Error:

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread Ali Çehreli via Digitalmars-d-learn
On 04/28/2017 08:56 AM, ParticlePeter wrote: > C++ Function: > bool cppFunc( float[3] color ); > > D binding: > extern(C++) bool cppFunc( float[3] color ); > > Using with: > float[3] my_color; > cppFunc( my_color ); > > -> Error: Internal Compiler Error: unable to pass static array to That part

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread ParticlePeter via Digitalmars-d-learn
On Friday, 28 April 2017 at 17:15:54 UTC, kinke wrote: On Friday, 28 April 2017 at 15:56:17 UTC, ParticlePeter wrote: So what next? How can I interface to the cpp function? *** C++: bool cppFunc(float ()[3]) { color[0] = 1; color[1] = 2; color[2] = 3; return true; } *** D:

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread kinke via Digitalmars-d-learn
On Friday, 28 April 2017 at 15:56:17 UTC, ParticlePeter wrote: So what next? How can I interface to the cpp function? *** C++: bool cppFunc(float ()[3]) { color[0] = 1; color[1] = 2; color[2] = 3; return true; } *** D: extern(C++) bool cppFunc(ref float[3] color); void

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread Kagamin via Digitalmars-d-learn
Report a bug.