Home |
RTTarget-32 Programming Manual Running Win32 Programs without Win32 Running a Program on the Target Compiling and Linking with On Time RTOS-32 Borland Delphi |
Borland DelphiOn Time RTOS-32 applications are compiled and linked as Win32 Console mode applications. Since the Delphi compiler by default generates GUI programs, command line option -CC must be specified. Programs using any of On Time RTOS-32's import units located in directory Libdel must be compiled with command line option -U to enable the compiler to find these units. Assuming On Time RTOS-32 has been installed in directory C:\Ontime, the example program Hello.pas can be compiled and linked using: dcc32 -v -CC -UC:\Ontime\Libdel Hello.pas Delphi programs cannot directly link any LIB files shipped with On Time RTOS-32. Instead, a System DLL containing these libraries must be used. For applications only using On Time RTOS-32 component RTTarget-32, the preconfigured System DLL Rtt32dll.dll is included in the Bin directory. It contains RTTarget-32's complete API except function RTMakeBootDisk (which requires RTFiles-32). If you need additional functions from RTKernel-32 or RTFiles-32 or if you want to link a smaller subset version of Rtt32dll.dll, you must create a custom System DLL using a linker which can process .LIB files (e.g., TLINK32 or ILINK32 shipped with Borland C++ or Borland C++ Builder). Please refer to Advanced Topics, section Using a Custom System DLL for details on how custom System DLLs are linked. PE files produced by Delphi may contain these sections which must be located: section CODE, .itext, DATA, BSS, .tls, .rdata, and .idata. If exported functions are to be available at run time using GetProcAddress, the .edata section is also required. Locate NTSection commands must be used to build Delphi programs. A heap with at least 32k is required. A stack of at least 16k is recommended. The linker of Borland C++ Builder names section CODE and DATA .text and .data, respectively. A typical configuration file for Delphi programs is: #ifsection .text // redefine some section names for BCB #define CODE .text #define DATA .data #define BSS .bss #endif #ifndef BOOT Reserve Monitor // leave room for the Debug Monitor #endif Virtual SysMem 1G+0M+4k // system DLL goes here Virtual ProgMem 1G+1M+4k // main program goes here Virtual HeapMem 1G+4M FillRAM HeapMem DLL Rtt32dll.dll // include the RTTarget-32 system DLL #ifsection Rtt32dll.dll..text // redefine some section names for BCB #define Rtt32dll.dll.CODE Rtt32dll.dll..text #define Rtt32dll.dll.DATA Rtt32dll.dll..data #endif // map some stuff we always need Locate PageTable PageTable HighMem Locate Header Header HighMem Locate Stack Stack ProgMem->HighMem 16k Locate Heap Heap HeapMem // map the main program and the RTTarget-32 DLL Locate NTSection CODE ProgMem->HighMem Locate NTSection .itext ProgMem->HighMem Locate NTSection DATA ProgMem->HighMem Locate NTSection BSS ProgMem->HighMem Locate NTSection .idata ProgMem->HighMem Locate NTSection .edata ProgMem->HighMem Locate NTSection .tls ProgMem->HighMem Locate NTSection .rdata ProgMem->HighMem Locate NTSection .rsrc ProgMem->HighMem Locate NTSection Rtt32dll.dll.CODE SysMem->HighMem Locate NTSection Rtt32dll.dll.DATA SysMem->HighMem Locate NTSection Rtt32dll.dll..edata SysMem->HighMem // allow data compression Locate DecompData Buffer HighMem Locate DecompCode Expand HighMem // and compress everything Locate Copy PageTable HighMem Locate Copy CODE HighMem Locate Copy .itext HighMem Locate Copy DATA HighMem Locate Copy .idata HighMem Locate Copy .rsrc HighMem Locate Copy Rtt32dll.dll.CODE HighMem Locate Copy Rtt32dll.dll.DATA HighMem Locate Copy Rtt32dll.dll..edata HighMem Please refer to the demos under directory Demodel for numerous examples of building programs with Delphi. Compiling and Linking with On Time RTOS-32
|