
102 Appendix A4 Using OxGauss
....................................................samples/oxgauss/gaussfunc.h
namespace gauss
{
extern decl _g_base;
gaussfunc(const a, const b);
}
.......................................................................................
Next, the OxGauss code must be imported into the Ox program. The #import
command has been extended to recognize OxGauss imports by prefixing the file name
with gauss::, as in the following program:
...................................................samples/oxgauss/gausscall.ox
#include <oxstd.h>
#import "gauss::gaussfunc"
main()
{
gauss::_g_base = 20;
decl z = gauss::gaussfunc(10,2);
println("result from gaussfunc", z);
}
.......................................................................................
When the OxGauss functions or variables are accessed, they must also be prefixed
with the namespace identifier gauss::. The output is:
calling gaussfunc
result from gaussfunc
30.000 10.000
10.000 30.000
A4.5 How does it work?
When an OxGauss program is run, it automatically includes the ox/include/oxgauss.ox
file. This itself imports the required files:
#define OX_GAUSS
#import <g2ox>
#import <gauss::oxgauss>
These import statements lead to g2ox.h and oxgauss.h being included. The ma-
jority of the OxGauss run-time system is in g2ox.ox. The keywords are largely in
oxgauss.src, because they cannot be defined in Ox (however keyword functions can
be declared by prefixing them with extern "keyword",seeoxgauss.h).
A4.6 Some large projects
The objective now is to give several serious examples, discussing some of the issues
that can be encountered. The code for these is available on the internet.
Commentaires sur ces manuels