Shared Library: Why doesn't this work?
Benji Smith
dlanguage at benjismith.net
Wed Oct 1 21:07:29 PDT 2008
Bryan Power wrote:
> Benji Smith wrote:
>> if (auto lib = SharedLib.load(`c:\windows\system32\kernel32.dll`)
>
> Just a note on the Windows library loading routines:
>
> You should never use the absolute path. The root drive is not guaranteed
> to be C:, nor is the system directory guaranteed to be "system32". On
> older systems it may just be "system". Internally, the API .load is
> calling (LoadLibraryA/W) will automatically search the default system
> directory of your system, therefore only .load("kernel32.dll") is required.
Aha. That's good to know.
I was only using the absolute path for this little example. My actual
code was going through its own system of tests to find the system
directory. That was a waste!
Thanks!
--benji
More information about the Digitalmars-d-learn
mailing list