Adding the parts
Begin by creating a new visual part. Don't add any of the Text parts yet, because they will be added using quick forms.
Creating the function interface
Select the External Functions category and then the external function part you want, either a C External Function part or a COBOL External Function part. Drop the part on the free-form surface and open its settings. Change the following settings on the DLL settings page:
File name
Type CATM (or ATM if you are using COBOL), the dynamic link library where the procedure is stored. Enter the name in all uppercase, but enter only the DLL name, not the path or extension.
Entry point name
Type atm for C or ATM for COBOL. This is the name of the procedure to call. Remember that this name is usually case-sensitive, depending on the options you use when creating the DLL. In this case, the catm.mak file specified the /NOI link option that maintains case sensitivity.
Note:
For AIX the entry point name comes from the primitive table that was built when the library was created and linked.
Entry point type
Select 16 or 32, depending on whether your compiler produces 16- or 32-bit object code.
Note:
This is not shown for AIX, because all calls use 32.
Calling convention
The calling convention setting determines how parameters are passed to the external function. You must choose the correct calling convention so that when the function is called, parameters are sent in the order that they are expected.
Unless you select different options when you compile and link your DLL, the correct setting for the C functions used in this example is the C calling convention.
Note:
This is not shown for AIX, because all calls use the C calling convention.
Also, you can not use any optimized calling conventions like _Optlink. Use standard system linkage conventions like _System.
Long operation
Check this setting if your function will take a long time to execute and you want it to run on a separate thread. This example does not need to be threaded.
Last modified date: 01/29/2015