next up previous contents
Next: OX_API Reference Up: Using ox_wrappers Previous: class OX_Machine

Setting things up

Now is the slightly weird part. Step one: define the macro OX_CLASS to be the name of your new derived class. If your class is called MyCoolDelay, then

#define OX_CLASS MyCoolDelay

It's important to do this before you include any ox_wrappers header files. The reason is that new functions, making statically-bound calls to your new member functions, are going to be created when you compile.

Next, derive your class from OX_Machine and place its declaration in, say, MyCoolDelay.h Then do the following:

#define OX_CLASS MyCoolDelay
#include ``ox_wrappers.h''
#include ``MyCoolDelay.h''
#include ``ox_wrappers.cc''

Now implement your member functions, and compile as a shared object. The wrapper will export the required OX_API functions with C linkage, so that OCTAL will be able to find them. When OCTAL calls them, ox_wrappers will forward the relevant info on to your machine.

You'll still have to use some C structures such as machine_type and param_spec when communicating with OCTAL. Your class inherits a data member m, which is a pointer to the underlying struct machine object that OCTAL is dealing with directly.

All the information in 1.3, 1.4, and 1.8 applies to use of ox_wrappers. You might need to override the new and delete operators so that they call the OX_API wrappers.


next up previous contents
Next: OX_API Reference Up: Using ox_wrappers Previous: class OX_Machine
David O'Toole
2000-07-19