How to get runtime args from shared static this module ctor?

Andrej Mitrovic andrej.mitrovich at
Mon Jan 9 09:00:10 PST 2012

I need to get the name of the executable but without using a string[]
from main. I'm wrapping a 3rd party library that requires me to
initialize it by calling an extern function to pass the executable

However I don't want to force the user to pass args from main when
constructing a class, so I was wondering if there's a cross-platform
way of getting the arguments which I could use in a shared static this
module constructor inside of my wrapper library?

Druntime probably has the arguments stored somewhere upon app entry
(before calling my main function). Is there a way to extract them?
Otherwise I'll have to use OS-specific APIs, but I'd rather avoid
those. Worst-case-scenario I'll just have to make passing args[] from
main a requirement of the library. It's not a big issue, but slightly

More information about the Digitalmars-d-learn mailing list