Exporting template function instances to C

data pulverizer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 23 09:28:18 PDT 2017


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 @system:
pragma(LDC_no_moduleinfo);
T mult(T)(T x, T y)
{
     return x*y;
}

double dmult(double x, double y)
{
	return mult(x, y);
}

float fmult(float x, float y)
{
	return mult(x, y);
}
```

Why is that?


More information about the Digitalmars-d-learn mailing list