next up previous contents
Next: Graphics output Up: How to implement a Previous: How to implement a   Contents

Introduction

Dynamic link libraries (in Windows) or shared objects (in Linux) are collections of methods loaded and linked at runtime. "Dynamic Linking" means that the memory address of the function is known only at runtime, and not previously at compilation time (as in static libraries).

GPU loads at runtime all dynamic link libraries in the subdirectory plugins of the application. They do not necessarily have to be implemented in Delphi and could be implemented in C as well.

In order to be called by the virtual machine, a method has to have the following signature:

function add(var stk : TStack) : Boolean; stdcall;

stk is a variable passed by reference. In C-terminology, it is a pointer to a struct that contains an array of double (extended-precision floating points) and an index value that points to one of the array's elements. The function can modify this array and the index pointer as well, although typical functions like add simply add the two last parameters and push the result onto the stack. Finally, add returns true if the computation was successful; if there are not enough parameters, add returns false.


next up previous contents
Next: Graphics output Up: How to implement a Previous: How to implement a   Contents
Tiziano Mengotti 2004-03-27