How to get runtime args from shared static this module ctor?
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 name. 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 annoying.
Re: How to get runtime args from shared static this module ctor?
Am 09.01.2012 18:00, schrieb Andrej Mitrovic: 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 name. 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 annoying. They are stored in Runtime.args (you must import core.runtime). Joshua
Re: How to get runtime args from shared static this module ctor?
Sweeet, thanks Joshua! On 1/9/12, Joshua Reusch yos...@arkandos.de wrote: Am 09.01.2012 18:00, schrieb Andrej Mitrovic: 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 name. 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 annoying. They are stored in Runtime.args (you must import core.runtime). Joshua