Re: Exporting template function instances to C

2017-03-25 Thread data pulverizer via Digitalmars-d-learn
On Saturday, 25 March 2017 at 06:17:15 UTC, Nicholas Wilson wrote: On Saturday, 25 March 2017 at 02:21:33 UTC, data pulverizer wrote: Thanks a lot ... I was half joking playing with the name "mangling" but I appreciate your explanations and suggestions. This is the internet, I can't tell if yo

Re: Exporting template function instances to C

2017-03-24 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 25 March 2017 at 02:21:33 UTC, data pulverizer wrote: Thanks a lot ... I was half joking playing with the name "mangling" but I appreciate your explanations and suggestions. This is the internet, I can't tell if you're a newb or sarcastic, and given this is a learn forum I'm going

Re: Exporting template function instances to C

2017-03-24 Thread data pulverizer via Digitalmars-d-learn
On Friday, 24 March 2017 at 01:00:31 UTC, Nicholas Wilson wrote: On Thursday, 23 March 2017 at 19:46:43 UTC, data pulverizer wrote: On Thursday, 23 March 2017 at 17:58:21 UTC, H. S. Teoh wrote: On Thu, Mar 23, 2017 at 05:29:22PM +, data pulverizer via Thanks. Is there a less ham-handed wa

Re: Exporting template function instances to C

2017-03-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 23 March 2017 at 19:46:43 UTC, data pulverizer wrote: On Thursday, 23 March 2017 at 17:58:21 UTC, H. S. Teoh wrote: On Thu, Mar 23, 2017 at 05:29:22PM +, data pulverizer via Thanks. Is there a less ham-handed way of exporting them other than wrapping them in functions as I ha

Re: Exporting template function instances to C

2017-03-23 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 23 March 2017 at 17:58:21 UTC, H. S. Teoh wrote: On Thu, Mar 23, 2017 at 05:29:22PM +, data pulverizer via Thanks. Is there a less ham-handed way of exporting them other than wrapping them in functions as I have? Wrapping them in functions is probably the simplest way to cal

Re: Exporting template function instances to C

2017-03-23 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Mar 23, 2017 at 05:29:22PM +, data pulverizer via Digitalmars-d-learn wrote: > On Thursday, 23 March 2017 at 16:38:02 UTC, Adam D. Ruppe wrote: > > On Thursday, 23 March 2017 at 16:28:18 UTC, data pulverizer wrote: > > > alias mult!double dmult; > > > alias mult!float fmult; > > > > T

Re: Exporting template function instances to C

2017-03-23 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 23 March 2017 at 16:38:02 UTC, Adam D. Ruppe wrote: On Thursday, 23 March 2017 at 16:28:18 UTC, data pulverizer wrote: alias mult!double dmult; alias mult!float fmult; Those are just aliases in the D compiler, they don't actually exist in the object file for C to use like regular

Re: Exporting template function instances to C

2017-03-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 23 March 2017 at 16:28:18 UTC, data pulverizer wrote: alias mult!double dmult; alias mult!float fmult; Those are just aliases in the D compiler, they don't actually exist in the object file for C to use like regular functions. Templates need to actually be *used* to be instantia

Exporting template function instances to C

2017-03-23 Thread data pulverizer via Digitalmars-d-learn
I have noticed that the following will not successfully export `dmult` and `fmult` to C: ``` extern (C) nothrow @nogc @system: pragma(LDC_no_moduleinfo); T mult(T)(T x, T y) { return x*y; } alias mult!double dmult; alias mult!float fmult; ``` but this will ``` extern (C) nothrow @nogc @sys