Integration to Host Program

Parent Previous Next

Integration to Host Program

The host application loads the VM DLL - either statically or dynamically - and communicates with the DLL using the provided application programming interface (API).


The API functions allow for operations to create, execute, garbage collect and free VMs, but they can also be used to manage the cells of a given VM and provides callback functionality for each instantiated VM.


Details of the API.

The next pages describe all about the API functions and how to use them based on either a stdcall or cdecl calling convention. Each API function is presented in both Pascal and C/C++ syntax, and the arguments and their types are described in detail.


How to work with the API functions and how to pass data back and forth in a safe manner - without causing memory conflicts between the VM DLL and the host application - are described, and the close relationship between the API functions and the analog @VMxxxx library functions is presented.


Finally some tips and warnings related to multi-threaded execution are given.


C#.NET Integration.

In order to demonstrate how easy it is to use the API functions, a C# class for .NET has been developed to encapsulate all the native DLL API functions and provide an easy to use interface - which is very similar to using the @VMxxxx library functions.


The chapter C#.NET Integration is dedicated to presenting this implementation in detail - with a description of the code structure divided into small comprehensible sections.


A complete listing of The Source Code is included. How to work with the C# class (including the use of a callback function) is presented here.


All you have to do is to include the class in your C# project. Then you are ready to create and execute new VMs and manage the cells of each VM individually - just as if it was done in bytecode.


In case you are using another programming language, it should be quite easy to understand the C# source code, however before performing a conversion please have a look at the Language Conversion page.