On Thursday, 30 September 2021 at 01:09:47 UTC, Hipreme wrote:
I have a template function that all it does is given a symbol, it loads a dll for its type + its name:

```
void loadSymbol(alias s, string symName = "")()
{
        static if(symName == "")
                s = cast(typeof(s))_loadSymbol(_dll, (s.stringof~"\0").ptr);
        else
                s = cast(typeof(s))_loadSymbol(_dll, (symName~"\0").ptr);
}
```


The main problem is that this function is costing 2KB per instantiation, which is something pretty high. Specially if I inline, there is almost no cost when compared to its inline version. Trying to use pragma(inline, true) didn't do anything too.

cant you just use a regular functions ? loading happens at runtime right ?

Reply via email to