On 12/15/20 2:04 PM, Dave P. wrote:

> I want to pass
> some templated functions as function pointers to some C code

As Mike Parker said, it works:

// The same thing as a C function pointer:
alias Func = long function(int);

long bar(T)(int) {
  return 0;
}

Func f0 = &(bar!float);
Func d1 = &(bar!double);

> (and that different versions would be mangled
> differently).

Yes:

auto foo(T)() {
}

void main() {
  pragma(msg, foo!int.mangleof);
  pragma(msg, foo!double.mangleof);
}

Output:

_D6deneme__T3fooTiZQhFNaNbNiNfZv
_D6deneme__T3fooTdZQhFNaNbNiNfZv

Ali

Reply via email to