Reputation: 760
I am creating a [Windows] DLL which is primarily for use by non-delphi callers. I want to use some existing "library" code but there are some parts that might be inappropriate or problematic if they are being executed within a DLL.
Is there a way of detecting that the code is running within a DLL?
Upvotes: 2
Views: 486
Reputation: 335
if MainInstance <> HInstance then // => DLL
IsLibrary always has the value FALSE if runtime packages rtl are used consistently. The IsLibrary and IsConsole variables are global in this case. The values are set by the exe. They are not changed by the DLL.
Upvotes: 1
Reputation: 596477
Indicates whether the module is a shared library.
The IsLibrary variable is True if the module is a dynamic link library (DLL).
Upvotes: 8