[vbox-dev] call a method runtime

Klaus Espenlaub klaus.espenlaub at oracle.com
Tue May 20 17:01:11 GMT 2014


Johannes,

On 20.05.2014 16:04, Johannes DeWitt wrote:
> Hi, i'm looking for a way to call a method during the execution of
> virtualbox (runtime). I read that xpcom or soap can achieve that: in the
> source code i can write a method, with special definition and than,
> after compiling, i can execute the VM and call this method. Is it correct?
> Anyway i read SDK documentation, but i can't find a simple example.

Sounds plausible - but I can't claim I fully understood the problem 
description, mostly because it is so short.

Do you really need some API functionality which truly isn't there 
already (or can't be triggered by some other means)? Because adding 
methods usually means the API compatibility is broken, with the 
consequence that your custom code can't be mixed and matched with other 
binaries.

One way of triggering activities inside a VM process is by monitoring 
extradata change in Console::onExtraDataChange 
(src/VBox/Main/src-client/ConsoleImpl.cpp). If this almost matches what 
you need it'd be interesting to understand a bit more what you want to 
achieve (on a high level - the request to have some new functionality is 
relatively low-level and abstract).

If you really really want to add API methods, see e.g. 
https://www.virtualbox.org/changeset/48879/vbox

This change adds a new method to IMachine and a new attribute to 
IMediumAttachment (consider the change to VirtualBox.xidl the starting 
point - that's our abstract API definition, kind of a meta-IDL), plus 
settings handling and what not... still one of the simpler API changes.

These new API methods are used by 
https://www.virtualbox.org/changeset/49190/vbox which calls the method 
from VBoxManage etc etc.

Hope this gives enough hints. Adding APIs is in many ways mostly typing 
effort. The real complexity is that one needs to understand quite a bit 
of the sometimes not so trivial dependencies by other code or by 
(XP)COM. In latest trunk the almost completed transition to 
automatically generated API wrappers adds quite some "invisible" magic 
and adjusts a lot of conventions. Again more to understand before one 
can produce anything but compiler errors.

> Sorry for the bad syntax, but i'm not english.

As long as we can understand the core of your message we won't complain.

Klaus

> Thanks




More information about the vbox-dev mailing list