User Tools

Site Tools


special_considerations_for_one_piece_single_executables.htm
Navigation:  Advanced Topics > Legacy Project System Reference >====== Special Considerations for One-Piece (Single) Executables ====== Previous pageReturn to chapter overviewNext page

A one-piece executable is defined as a project that has been linked into a single, stand-alone executable. The Clarion runtime library and all of the application's procedure calls and libraries are linked into a single file.

Callback functions are a standard part of Windows programming in most programming languages. A callback function is a PROCEDURE that you (the programmer) write to handle specific situations that the operating system deems the programmer may need to deal with. A callback function is called by the operating system whenever it needs to pass on these situations. Therefore, a callback function does not appear to be part of the logic flow, but instead appears to be separate and “magic” without any logical connection to other procedures in your program.

Callbacks are valid when used in one-piece executables (EXEs), but there is a special case which must be handled in a different manner.

Here is the case:

If the EXE makes some call to the Operating System, the Operating System starts a new thread inside this call, and then calls to a passed callback function. Using this program design, the one-piece EXE must be converted to a DLL linked in local mode, and a starter EXE must be created, using an External link to the DLL entry point that is used to load and run the one-piece DLL.

The following approach demonstrates how this is done.

The one-piece EXE must be converted to a DLL linked in local mode.

The Local mode DLL must export the name of the entry point's procedure and the following names from the RTL:

checkversion sysstart

sysinit _exit Cla$code Cla$init Wsl$Closedown Here is an example of the export file (EntryPoint is the procedure entry into the DLL) ————————————– EXPORTS EntryPoint@F @? checkversion @? sysstart @? __sysinit @? _exit @? Cla$code @? Cla$init @? Wsl$Closedown @? In this example, the entry point procedure name in the Local DLL is: “EntryPoint” TipBox.jpg Use the Inside the Export List Global Embed to add to your export list within the application. The starter EXE must use External link mode. The source is written so that it just calls the DLL's entry point procedure. Example starter EXE code:  PROGRAM  MAP   MODULE('')    EntryPoint()   END  END  CODE  EntryPoint

special_considerations_for_one_piece_single_executables.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1