Matrix Elements VB-800 Manuel d'utilisateur Page 14

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 172
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 13
6 Appendix A1 Extending Ox
A1.2.3 Dynamic link library and search paths
Note that the operating system has to be able to find the DLL file. In the example above
we gave the partial path, assuming the Ox file is run from its current location.
When making a package for distribution, the proper location is the ox/packages
folder. By default, Ox will search relative to ox/include and then to ox. More for-
mally, if the specified DLL name in the extern statement contains a relative path, Ox
will search in
(1) in the folder of the source file;
(2) along the OX3PATH environment variable;
If this is not defined under Windows a default path will be derived from the loca-
tion of oxwin.dll.
(3) along folders specified in the import statement;
(4) if the library name does not contain a path at all, say it is xlib, then it will try
packages/xlib/xlib using the appropriate extension.
Alternatively you could add your own directory to the OX3PATH environment vari-
able, or use the #import statement.
A1.3 Adding C/C
++
code: returning values in arguments
Returning a value in an argument only adds a minor complication. Remember that by
default all arguments in Ox and C are passed by value, and assignments to arguments
will be lost after the function returns. To return values in arguments, pass a pointer to a
variable, so that the called function may change what the variable points to.
To refresh our memory, here is some simple Ox code:
#include <oxstd.h>
func1(a)
{a=1;
}
func2(const a)
{ a[0] = 1;
}
main()
{
decl b;
b = 0; func1(b); print(b);
b = 0; func2(&b); print(b);
}
This will print 01.Infunc1 we cannot use the const qualifier because we are changing
the argument. In func2 the argument is not changed, only what it points to.
The first serious example is the invert function from the standard library, which
also illustrates the use of a variable argument list.
Vue de la page 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 171 172

Commentaires sur ces manuels

Pas de commentaire