Code generated at run time is important for applications that include:
To maintain stack traceability and to support exception handling for code that is generated at run time, procedure descriptors must be provided for that code. Such procedure descriptors must describe correctly the characteristics of the code and the environment within which that code executes.
Before run-time generated code can be executed, the following system library function must be called to activate its corresponding procedure descriptors:
RtlAddFunctionTable( FunctionTable, EntryCount )
Arguments
FunctionTable
Specifies the address of an array of procedure descriptors, where each element is of type RUNTIME_FUNCTION.
EntryCount
Specifies the number of procedure descriptors in the array.
Function value
Success
TRUE (=1) indicates the function completed successfully; FALSE (=0) indicates the function did not finish successfully.
Remarks
A function table must not be modified in any way while the table is active; if any changes are required, the table must be deactivated (using RtlDeleteFunctionTable(), see below), modified, and then reactivated using RtlAddFunctionTable().
Note that active dynamic procedure descriptors are included in the searches performed by RtlLookupFunctionEntry() or RtlLookupDirectFunctionEntry().
When procedure information is no longer valid or the code will not be executed again, the following system library function should be called to deactivate the procedure descriptor information:
RtlDeleteFunctionTable( FunctionTable )
Arguments
FunctionTable
Specifies the address of an array of procedure descriptors that was passed in a previous call to RtlAddFunctionTable().
Function Value
Success
TRUE (=1) indicates the function completed successfully; FALSE (=0) indicates the function did not complete successfully.
The following steps show how run-time code should be constructed and destroyed:
Note The execution environment may analyze a function table when it is made active and cache certain summary information to facilitate later searching. For example, a table that is sorted in increasing order by its BeginAddress field might be later searched using a binary rather than a linear search.