Home |
RTTarget-32 Programming Manual Running Win32 Programs without Win32 Link Command Running a Program on the Target Compiling and Linking with On Time RTOS-32 |
Link CommandRTLoc will usually resolve DLL imports to DLL exports of DLLs located using the DLL command the same way as Win32 program loaders would. However, to achieve greater flexibility, the Link command may be used to change such linkage. The syntax of the Link command is: Link ModuleName.ImportedName [ModuleName.]ExportedName or Link ModuleName.Ordinal [ModuleName.]ExportedName ModuleName.ImportedName or ModuleName.Ordinal specifies that a DLL function referenced by one or more modules of the application is to be replaced by function [ModuleName.]ExportedName. If [ModuleName.] is not specified, the main program is assumed. Function name matching is case sensitive; module names, however, are case-insensitive. Parameters ModuleName, ImportedName, and ExportedName may be replaced by the wildcard '*'. In this case, RTLoc will match up imports against exports. If several Link commands are used, they are processed in the order given in the configuration file. If ModuleName is '*', it matches any module. If ImportedName is '*', it matches any DLL import. If both ImportedName and ExportedName are '*', the two names must be identical for a match. ExportedName must not be '*' if ImportedName is not '*'. Parameter Ordinal cannot contain wildcard characters; it must be a single numeric value. RTLoc does not support ordinal exports. If a module contains ordinal imports (which are discouraged by Win32), you must use the Link command to resolve them. Examples:Link Somelib.dll.SomeFunc MyFunc // all calls to Somelib.dll.SomeFunc are rerouted to MyFunc Link Somelib.dll.* Otherdll.dll.MyFunc // all calls to any function of module Somelib.dll rerouted // to MyFunc in Otherdll.dll Link *.SomeFunc MyFunc // calls to function SomeFunc of any module are rerouted // to MyFunc of the main program Link *.* MyFunc // all calls to any imported functions are rerouted to MyFunc Link SomeLIB.* * // all calls to imported functions from module SomeLIB are // rerouted to functions with the same name in the program Link *.* * // all calls to imported functions are rerouted to functions // of the program with the same name Assume you want to link functions A and B of DLL SomeDLL to your own functions MyA and MyB, function C of OtherDLL to MyOtherC, and all other functions to a handler for unsupported calls: Link Somedll.dll.A MyA Link Somedll.dll.B MyB Link Otherdll.dll.C MyOtherC Link *.* UnsupportedAbort The Link command requires the import table of the program to be located with a Locate command. The import table is usually named .idata. If you are unsure about the exact names of imported or exported functions, use RTLoc option -Rd and look them up in the .LOC file's .EXE file report. Naming conventions may vary depending on the compiler, compiler version, and calling conventions. RTLoc attempts to resolve static DLL references with the following methods in the given order:
|