vm_initialization.rst 647 B

12345678910111213141516171819202122
  1. .. _embedding_vm_initialization:
  2. ==============================
  3. Virtual Machine Initialization
  4. ==============================
  5. The first thing that a host application has to do, is create a virtual machine.
  6. The host application can create any number of virtual machines through the function
  7. *sq_open()*.
  8. Every single VM that was created using *sq_open()* has to be released with the function *sq_close()* when it is no
  9. longer needed.::
  10. int main(int argc, char* argv[])
  11. {
  12. HSQUIRRELVM v;
  13. v = sq_open(1024); //creates a VM with initial stack size 1024
  14. //do some stuff with squirrel here
  15. sq_close(v);
  16. }