【发布时间】:2012-01-10 23:48:30
【问题描述】:
我要实例化一个函数指针:
static void GetProc (out function f) {
auto full = demangle(f.mangleof);
auto name = full[full.lastIndexOf('.')+1..$];
f = cast(typeof(f)) GetProcAddress(hModule,name.toStringz);
}
但是编译器不允许我使用函数类型变量(out function f)。我尝试使用Object,但显然function 不是Object(怎么来的??)。那么,我如何将function 作为ref/out 变量传递(不使用template/mixin,这会掩盖代码并迫使我添加许多typeof 语句...)?
【问题讨论】: