User Tools

Site Tools


compiler_integration.htm
Navigation:  Advanced Topics > Multi Language Programming >====== Compiler Integration ====== Previous pageReturn to chapter overviewNext page

Source File Extension Compiler Called

.CLW    Clarion

.CPP or .C   C++

.MOD    Modula-2

Source files with any other extensions will generate an 'Unknown compiler for …' error message at compile time.

The Development Environment will also ensure that all modules are linked correctly and that the SoftVelocity SmartLinker is given all the information that it requires.

Integrating Modules into Clarion Projects

Using the Application Generator:

1. Create an “Include file” containing the function prototypes for the Clarion compiler.

You MUST prototype your functions if you intend to call them from Clarion code (see Procedure Prototyping in the Language Reference). The include file should contain prototypes for all 3GL functions called from Clarion code. Each 3GL module should have its own include file.

The include file is put in the Generated source without modification by step 3 of this process. The generated Clarion code for your include file appears in the Global Map something like this:

MODULE('module name')

INCLUDE('YourInc.Inc')

END

The Application Generator generates the MODULE and END statements. Failure to correctly prototype your functions will almost certainly result in a General Protection Fault at run time.

2. Use the Text Editor to write your 3GL code.

Be sure to save the code with a file extension that the compiler can recognize (.C, .CPP, .MOD, or .PAS).

3. Add the module to the application as an External Source Module.

Select Application > Insert Module from the main menu. Then select class External Source from the Select Module Type dialog. Press the ellipsis button, and in the Open File dialog, enter the name of the 3GL module in the Name field and click on the Open button, Back in the Module Properties dialog, enter the name of the include file in the Map Include File field of the Module Properties dialog. Press OK to add to the application tree.

4.Compile and run the application.

In a hand-coded Clarion application:

1.  Create the function prototypes for the Clarion compiler.

You must prototype the functions you intend to call from Clarion code (see Procedure Prototyping in the Language Reference). The global MAP structure should contain the prototypes.

Each 3GL module should have its prototypes in a separate MODULE structure, something like this:

MODULE('module name')

MyFunc(*CSTRING),CSTRING,RAW,PASCAL,NAME('_MyFunc')

END

You must include a complete MODULE structure in your Clarion MAP for all your 3GL modules. Failure to correctly prototype your functions will almost certainly result in a General Protection Fault at run time.

2.  Use the Text Editor to write your 3GL code, saving the code with a file extension that the compiler can recognize (.C, .CPP, .MOD, or .PAS).

3.  Add the module to the Project as an External Source File.

Select Project > Edit from the main menu. Highlight External Source Files then press the Add File… button. Select the 3GL source mofule from the standard file open dialog that appears.

4.  Compile and run the application.

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