如果Delphi应用程序使用DLL(也是用Delphi创建的),那么会在System.pas中声明变量的多个版本吗?在使用DLL的应用程序中的System.pas中的全局变量
我刚刚读了How to determine if I'm running as a console app? (Delphi on Win32),注释说明可以有多个版本,例如System.IsConsole,它们具有不同的值 - 在EXE中为True,在DLL中为False(如果使用$ APPTYPE CONSOLE编译)。
但其他变量似乎是专为应用程序范围的值,例如
MainInstance: LongWord; { Handle of the main(.EXE) HInstance }
CPUCount: Integer; { Number of CPU Cores detected }
开发者如何才能看到它的值将在应用层上进行分配,以及哪些变量是模块特定的(所以能在DLL和EXE中有不同的值)?
还是我误解了这些全局变量?例如,System.BeginThread的文档说它设置全局变量System.IsMultiThread - 但它怎么可能是全局变量而System.IsConsole不是?
MainInstance在dll中是0,否? –
是的@Sertac。 * System.pas *本质上是这样的:'IsLibrary:= MainInstance = 0'。 –