Introduction to C Wrapper

EntireX C Wrapper provides access to RPC-based components from C applications. It enables you to develop both client and server applications. This document covers the following topics:


Description

The C Wrapper enables access to RPC servers for C client applications and access to C servers for any RPC client. The C Wrapper generation tools of the Designer take as input a Software AG IDL file that describes the interface of the RPC and generates C sources that implement the functions and data types of the interface. If there is a related server mapping file (Natural | COBOL), this is also used (internally).

graphics/cWrapper_overview.png

The generated functions can be compiled with the C compiler of your target platform.

The C Wrapper works as follows:

  • C code is generated from the IDL file. If there is a related server mapping file (Natural | COBOL), this is also used (internally).

  • The generic RPC C runtime implements functionality that is not specific to a given IDL file (e.g. broker logon and logoff, marshalling and unmarshalling of data). The generated C code makes use of the RPC C runtime functionality.

  • The Software AG IDL Compiler and an appropriate template are used for the C code generation.

Generic RPC C Runtime

In order to minimize the amount of code generated for a specific IDL, all service-type functionality required by the client interface object or the server interface is implemented in a generic RPC C runtime library. The generic RPC C runtime implements functions, for example:

  • marshalling C data types to Software AG IDL data types

  • unmarshalling Software AG IDL data types to C data types

  • connecting RPC clients to RPC servers via the broker

  • etc.

C Client Applications

For a given IDL file, the Software AG IDL Compiler and a C code generation template for clients are used to generate client interface objects and header files. If there is a related server mapping file (Natural | COBOL), this is also used (internally). The source code generated by the C Wrapper can be compiled with your target C compiler. Application developers use the generated interface object(s) and the header file to write C applications that access RPC servers.

graphics/cWrapper_client.png

For more information, see Using the C Wrapper.

C Server Application

The Software AG IDL Compiler and a C code generation template for servers are used to generate interface object(s) and a server (skeleton) for a specific IDL file.

Application developers use the generated server (skeleton) to write their own server code for each program in the IDL. The source code is compiled and linked with your target C compiler and linker into interface object and server libraries. Your server library name needs to match the library name as specified in the IDL file. The interface object library has the same name as your server library prefixed with the letter "D".

graphics/cWrapper_rpcServer.png

For more information, see Using the C Wrapper.