FlagShip Lifesaver Graphic

FlagShip Offers You Full C Access

Beside the prg language (Xbase syntax), FlagShip offers you full access to programs and functions written in the C language. There are three different API's for that reason (all described in detail in the manual):

1. Open C API, supporting vice-versa access of linked in C functions. This API also allows you to include inline C code directly in the prg source. You may even access all of the functionality of your system libraries, e.g:

** File: myprog.prg
STATIC pi := 3.14        && supports standard Clipper var types
LOCAL  myvar AS double   && but also typed variables
myvar = pi / 6.0
   myvar = sin(myvar);   /* access to std. C lib */
? myvar                  // prints 0.50
In extreme cases, you may write the whole application in C, and may use all the standard functions (i/o, database, dynamically scoped variables, macros, etc.) from the FlagShip library. The only requirement is that the start module (main) is a .prg application.

Why the above wording, "in extreme cases?" You need approximately 10 to 25 times more source lines in C (and the same amount of additional debugging effort) than in the .prg language. Normally, only modules that require special handling, library access or need compatibility with external modules (real-time events, 3rd party C libraries, Java scripts and so on) are written in C.

2. Extend C API is compatible with Clipper (Summer '87 to 5.2 and 5.3.) So, if your available source already uses this interface, you probably won't need to change them.

** File: myprog.prg
  ? sinus (179.53)         // print the sinus of 179.53 degree

  /* File: sinus.c */
  #ifdef FlagShip           /* FlagShip vs. Clipper usage */
  # include "FSextend.h"
     FSudfname (sinus)      /* FlagShip Extend API syntax */
  #else                     /* for Clipper */
  # include "extend.h"      /* or extend.api */
  # define FSreturn return;
  # define FSinit()
     CLIPPER SINUS()        /* Clipper Extend API Syntax */
     double degree, retval = 0.0;
     FSinit();                    /* init parameter stack         */
     if (PCOUNT == 1 && ISNUM(1)) /* check received parameter(s)  */
       degree = _parnd (1);       /* get 1st paramater as double  */
       retval = sin(3.141592 * degree / 180.0);
     _retnd (retval);             /* pass the value back          */

3. Modification of the produced C source. This is a possible, but not generally suggested option. Since the FlagShip compiler produces plain .c code as an intermediate step in the .prg compilation, you can modify the generated .c code and then use the modified .c code for the FlagShip compiling and linking step. Of course, when modifying the .prg source anew, your previous .c changes are lost. But it demonstrates FlagShip's flexibility and system independence.

Additional, detailed information is available in the on-line and printed FlagShip manual (section EXT.)

MultiSoft Logo

| FlagShip Home Page | What's New | Info | Press | Demos | Order | Tools | Support | Email |

Trademarks: multisoft and the multisoft logo are registered trademarks of multisoft GmbH Munich. FlagShip is a trademark of multisoft GmbH. Other products named here may be trademarks of their respective manufacturers.