10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How You Can Call 3GL ProceduresThe my3glprocedure procedure declared corresponding parameters as follows:my3glprocedure (var1, var2, var3)int var1, var2;char *var3;{...}For information about matching data types between 3GL procedures andOpenROAD variables, see the Language Reference <strong>Guide</strong> online help.Note: Because the parameters must match exactly in position and type, youmust specify all parameters to a 3GL procedure. The OpenROAD runtimesystem does not check errors in parameter passing to 3GL procedures; sucherrors can result in abnormally terminated programs. If you are usingOpenROAD Workbench, it could abort without saving your changes.As with 4GL procedures, OpenROAD lets you pass parameters to 3GLprocedures by reference. The following example shows two parameters passedby reference and one passed by value:callproc my3glprocedure(byref(floatvar), 36,byref(textvar));To help ensure full portability across all systems, pass all floating pointparameters to C procedures with the byref qualifier, even if you do not want tochange the value of the data in the C procedure. For example, the followingstatement calls the scale_y_array procedure, passing it two floating pointparameters (vmin and vmax) by reference:callproc scale_y_array(byref(vmin), byref(vmax),ymax - (labelheight*2), 0, sales_array);Important! There are limits to the number of parameters you can pass to a3GL procedure. The specific limit depends on the platform, the language inwhich the procedure is written, and the data types of the parameters. If youwant your application to be portable across all platforms, do not pass morethan 39 parameters to a 3GL procedure.If you pass floating point parameters to C procedures without the byrefqualifier, the limit may be smaller. Floats passed by value require an 8-byteparameter for a copy of the float, whereas floats passed by reference requireonly a 4-byte parameter for the address of the float (on 32-bit platforms).Using 3GL in Your Application 297

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!