Enhancement on `export` symbol

Hipreme msnmancini at hotmail.com
Fri Mar 14 00:07:07 UTC 2025


Currently, my engine is using `export` for debug builds, while I 
wanted to not `export` things for release build.

That happens because I structured the engine to load a game as a 
DLL when in development. But for releases, it gets all built 
together. The problem is that the symbols are still `export`ed. 
And exporting a symbol increases binary size needlessly and also 
(possibly) losing some optimization opportunities since that 
symbol is exposed.

```d

version(Standalone)
{
     extern(System):
}
else version(dll): export extern(System):


int[2] getWindowSize(){return [HipRenderer.width, 
HipRenderer.height];}

void setWindowSize(uint width, uint height)
{
     HipRenderer.setWindowSize(width, height);
     HipRenderer.setViewport(viewport);
     
camera.setSize(cast(int)viewport.worldWidth,cast(int)viewport.worldHeight);
}

```

This is basically what I'm needing. I know that asking for that 
may be a chaos. But it would be good to at least have something 
like `export(dll)` or something like that, so, at least I would 
be able to use `version` for identifying if I need that exported 
or not.

That would basically mean, if I'm specifying `-version=dll`, 
`export` would work, else, it won't matter.


More information about the Digitalmars-d mailing list