How to compile a Gen C External Action Block for Windows
search cancel

How to compile a Gen C External Action Block for Windows

book

Article ID: 11169

calendar_today

Updated On:

Products

Gen Gen - Workstation Toolset

Issue/Introduction

How do you compile a Gen External Action Block (EAB) for the C programming language under Windows.

Environment

Release: 8.6.3

Resolution

In order to compile a CA Gen EAB, perform the following steps:

1. First make sure that a copy of the EAB source stub module (.c file) has been moved to a location other than the <model>.ief\c directory. This will ensure that in case the procedure containing the EAB is generated again, the custom code added to the EAB will not be lost. In essence, the EAB should be maintained outside the <model>.ief\c directory.

2. Add your custom code to the newly copied EAB source stub module.

3. In order to compile the EAB in an easy manner (and repeatedly as needed), create and run a batch/command script file in the same directory as the source file e.g. compile_eab.bat.
This example is for a Gen GUI client application EAB with the name myeab which performs 2 steps:
 - Calls the GENEV.BAT file to set up the correct Visual Studio environment - in this example 32-bit and VS 2019.
 - Compiles the source file myeab.c using the cl command to create myeab.obj which it then places into a new external library extrnc.lib
===
call "%Gen86%\Gen\GENENV.BAT" 32 2019
set INCLUDE=%INCLUDE%;%Gen86%\Gen
cl -c -EHsc -Zc:forScope- -W3 -Od -nologo -DCGGUI -DNDEBUG -D_WINDOWS -D_MBCS -MD -D_AFXDLL -DWIN32 -DWIN -D_X86_ -Dtry=cktry -Dexcept=__except -Dleave=__leave -Dfinally=__finally -D_CRT_SECURE_NO_DEPRECATE -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -DMSC -DNONTTRACE -DWIN_NT -DREENTRANT myeab.c
lib /out:extrnc.lib myeab.obj
===

NOTE: In the above the compile options are taken from a .out file created by the Build Tool for a Window Manager build for a Gen GUI client which is also 32-bit. If building an EAB for a Gen server it would be best to check a similar .out file to get the correct compiler options. A Gen C server can be 32-bit or 64-bit.

Attachments

1558716817485000011169_sktwi1f5rjvs16uc3.gif get_app