| **Navigation:**  [[advanced topics 1.htm|Advanced Topics]] > Legacy Project System Reference >====== Special Considerations for One-Piece (Single) Executables ====== | [[project system examples.htm|{{btn_prev_n.gif|Previous page}}]][[advanced topics 1.htm|{{btn_home_n.gif|Return to chapter overview}}]][[multi language programming.htm|{{btn_next_n.gif|Next 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|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**