How to Compile a CA Gen External Action Block, EAB on Windows.

Document ID : KB000011169
Last Modified Date : 14/02/2018
Show Technical Document Details

How do you compile a CA Gen External Action Block (EAB)?


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

  1. Before compiling the EAB, first make sure that a copy of the EAB source 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. The example screen shot below shows a folder under the extrn folder called myEABs to which a copy of the EAB source module was moved to from <model>.ief\c directory.

Figure 1

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

In order to compile the EAB in an easy manner (and repeatedly as needed), create a script (.bat file) containing the commands shown below. Alternatively, the following commands can also be run through a DOS prompt one by one instead of putting them in a script file.

In order to create the script, open a text editor and copy/paste the code shown below.

# AllFusion(R) Gen Generated makefile for TAKE_CM_ACTION object module
# Copyright (c) 2007 CA. All rights reserved.

#Set the environment for using Microsoft Visual Studio 2005
if exist "%vs80comntools%vsvars32.bat" call "%vs80comntools%\vsvars32.bat"

#Compile TAKECMAC.c
cl -c -I"C:\AllFusion Gen\Gen" -EHsc -Zc:forScope- -W3 -Od -nologo -DCGGUI -DNDEBUG -D_WINDOWS -D_MBCS -MD -D_AFXDLL -DWIN32 -D_WIN32 - 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 -Fo"C:\models76\extrn\myEABs\MYEAB.obj" "C:\models76\extrn\myEABs\MYEAB.c"

# If extrnc.lib does not exist then create the external library file 
lib /out:extrnc.lib MYEAB.obj

Before saving the file and executing it, following changes may have to be made to the 'cl' command shown above under the ' #Compile TAKECMAC.c' section:

    • Replace "C:\AllFusion Gen\Gen" with the appropriate path to your %IEF% folder
    • Replace "C:\models76\extrn\myEABs\MYEAB.obj" with the path to where you want your EAB .obj file to be created
    • Replace "C:\models76\extrn\myEABs\MYEAB.c" with the appropriate path to your EAB .c file

Save the file with a .bat extension, for e.g. mak_action.bat, in the same location as your EAB source module .c file (see example below). Close the file.

Figure 2

Compile the EAB by executing the script created in step 2. To do this o pen a DOS prompt and change to the folder where the newly created .bat file is present. Type the name of the .bat file and press enter.

Figure 3

Upon executing the mak_action.bat file the output in the DOS prompt window should look something like this:

Figure 4

Upon a successful compile of the EAB, the .obj file and the extrnc.lib file should appear in the myEABs folder.

Figure 5

The extrnc.lib file contains the compiled EAB and is now ready to be used with your application.