functionLinkage

Determine the linkage attribute of the function.

template functionLinkage (
alias func
) if (
isCallable!func
) {
enum string functionLinkage;
}

Parameters

func

the function symbol, or the type of a function, delegate, or pointer to function

Return Value

one of the strings "D", "C", "C++", "Windows", "Objective-C", or "System".

Examples

extern(D) void Dfunc() {}
extern(C) void Cfunc() {}
static assert(functionLinkage!Dfunc == "D");
static assert(functionLinkage!Cfunc == "C");

string a = functionLinkage!Dfunc;
assert(a == "D");

auto fp = &Cfunc;
string b = functionLinkage!fp;
assert(b == "C");

Meta