Page 1 of 1

Checking the version of the Virtual Box installer and SDK

PostPosted: 28. Dec 2016, 07:46
by AdityaM
Hello,
I am trying to get the version of Virtual Box Installer and Virtual Box API. I have found the respective APIs to get the Installer Version (wstring IVirtualBox::version) and SDK Version (wstring IVirtualBox::APIVersion).

My requirement is that I want to take different actions if the Installer version is lower than 5.0. How can I achieve this, as it is not just the product version number represented in string format, but it might also be followed by some _ALPHA[0-9]*, _BETA[0-9]* or _RC[0-9]* tag.
I mean definitely logic to parse out the required string can be written but is there any other straight forward mechanism to achieve this, through some API or MACRO which I might have missed to look into.

Also I wanted to ask how important is the cohesiveness between Virtual Box SDK version and Installer. For example in one of the topics in this forum it is suggested not to mix different SDK and Installer version - - https://forums.virtualbox.org/viewtopic.php?f=34&t=56822&p=269621&hilit=version#p269621
So as per this I think it is also better to make a validation regarding the SDK version and Installer version for my requirement, what would be your suggestion?
So in that case we can expect that there would always be a simultaneous releases of both SDK and corresponding Installer for Virtual box by Oracle. And even in that case the output format returned by wstring IVirtualBox::version and wstring IVirtualBox::APIVersion API is different (one is numbers separated by '.' and other numbers separated by '_') so again it would be required to implement parse and check logic.

Please let me know your comments.

Thanks

Re: Checking the version of the Virtual Box installer and SDK

PostPosted: 28. Dec 2016, 23:13
by noteirak
There are three things to consider here:
- The API version (IVirtualBox::APIVersion) must always match between the VirtualBox binaries and the SDK you are using. Each VirtualBox release has a corresponding SDK
- To ensure 100% compatibility, you should use the exact SDK that was build alongside the specific VirtualBox binaries. This is not a must if the API version (x_y) match, but highly recommended.
- You should definitely never mix binairies and SDK coming from difference sources (official build vs OSE build per ex) as this will most likely introduce insidious errors due to possible slight incompatibilities.

Re: Checking the version of the Virtual Box installer and SDK

PostPosted: 23. Aug 2017, 13:25
by AdityaM
Hello,
I have a problem/confusion here when using the APIs IVirtualBox::get_APIVersion() and IVirtualBox::get_Version(). I would like to explain the output of these functions in 2 different scenarios:

Scenario 1:
PreReq: Windows 7 Service Pack 1, VirtualBox Version 5.0.22

Actual Output:
IVirtualBox::get_APIVersion() = "5_0"
IVirtualBox::get_Version() = "5.0.22"

Expected Output/Output as per my understanding:
IVirtualBox::get_APIVersion() = "5_1"
IVirtualBox::get_Version() = "5.0.22"

Scenario 2:
PreReq: Windows 7 Service Pack 1, VirtualBox Version 5.1.22

Actual Output:
IVirtualBox::get_APIVersion() = "5_1"
IVirtualBox::get_Version() = "5.1.22"

Expected Output/Output as per my understanding:
IVirtualBox::get_APIVersion() = "5_1"
IVirtualBox::get_Version() = "5.1.22"

In both the cases, is
Actual Output
correct or
Expected Output/Output as per my understanding
is correct. As per my understanding in both the scenarios I am getting the correct response for get_Version but in both the cases I should be also getting the same response for get_APIVersion which should be dependent on the SDK I am using and not on the installed version of VirtualBox.

Please let me know in case some more information is required from my side.
Regards
Aditya

Re: Checking the version of the Virtual Box installer and SDK

PostPosted: 23. Aug 2017, 13:45
by noteirak
Calling methods on IVirtualBox will always return the installed version/API version. So the actual outputs are all correct.
If you want to know what is the SDK version you are using, call VirtualBoxManager::getClientAPIVersion() which you can compare to IVirtualBox::getAPIVersion() to be sure they are matching.

Re: Checking the version of the Virtual Box installer and SDK

PostPosted: 28. Aug 2017, 07:07
by AdityaM
Hello,
Thanks for your reply. I am not able to make use of the method that is suggested to call "VirtualBoxManager::getClientAPIVersion()", in my C/C++ file. If I go through the SDK Reference, I can see that the class "VirtualBoxManager" is used in some example of Java API, and I think to access the class, we have to do an
Code: Select all   Expand viewCollapse view
import org.virtualbox_5_0.*


But apart from this I am not able to find any reference to it, I mean using it in C/C++ file. Is there some additional file that I have to include to get the access to this class and relevant module.
A little more help on this topic would be appreciated.
Thanks
Aditya