The last macro in the series would be the one that makes it possible to export certain symbols. Our implementation of a cryptographic core would export just one symbol--the GetPointers() procedure--which, in turn, would return a pointer to a structure containing pointers to the rest of procedures. This macro follows the previously defined pattern:
; In this specific case, when the macro would be called
; at the end of the source, we may replace the
; "macro finalize" declaration with the "postpone" directive.
macro finalize
{
if ACTIVE_TARGET = TARGET_W32_DLL
section '.edata' export data readable
export 'MA_CRYPTO.DLL',\
GetPointers, 'GetPointers'
else if ACTIVE_TARGET = TARGET_W32_OBJ
public GetPointers as '_GetPointers'
else if ACTIVE_TARGET = TARGET_W64_DLL
section '.edata' export data readable
export 'MA_CRYPTO.DLL',\
GetPointers, 'GetPointers'
else if ACTIVE_TARGET = TARGET_W64_OBJ
public GetPointers as 'GetPointers'
else if ACTIVE_TARGET = TARGET_L32_O
public GetPointers as 'GetPointers'
else if ACTIVE_TARGET = TARGET_L64_O
public GetPointers as 'GetPointers'
end if
}
The preceding macro would make the symbol visible to either a static or dynamic linker, depending on the target we are building. Alternatively, we could replace macro finalize with the postpone directive, which would force the body of the macro to be executed automatically once the end of the source is reached.
Now we may save the platform.inc file as we will not alter it in any way in the future.