Discussion:
[vbox-dev] Type conflicts in vbox C API
Taowei Luo
2014-06-02 04:28:35 UTC
Permalink
Hi, I'm developing the vbox drivers for libvirt, with the vbox c api.

I have a question. Is there any type conflict in vbox C API between
different versions?

For example, I have a var type named nsresult. In some C API versions, It
defines nsresult as type PRUint32. Is it true that all nsresults (in
different versions) will be defined as the same type PRUint32?

I know it may be false for structs which have function pointers. But in
other cases, especially basic types, is the type compatible with all c api
versions?

Thanks
Taowei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20140602/65b36d9d/attachment.html
Frank Mehnert
2014-06-02 13:52:50 UTC
Permalink
Hi Taowei,
Post by Taowei Luo
Hi, I'm developing the vbox drivers for libvirt, with the vbox c api.
I have a question. Is there any type conflict in vbox C API between
different versions?
For example, I have a var type named nsresult. In some C API versions, It
defines nsresult as type PRUint32. Is it true that all nsresults (in
different versions) will be defined as the same type PRUint32?
I know it may be false for structs which have function pointers. But in
other cases, especially basic types, is the type compatible with all c api
versions?
nsresult is always PRUint32. Note that this code is always a status
code and will never include any pointer or similar. Values bigger
than 0x80000000 are used for errors, NS_OK is defined as 0.

In general, the API will not differ between VBox versions of the same
stable branch but the API might change with a new major release. For
example, VBox 4.3.2 and 4.3.4 have the same API while VBox 4.2.2 and
4.3.2 differ a bit. Usually the changes between different API versions
are small and all changes are documented in section 12 of the VirtualBox
SDK documentation (SDKRef.pdf, not UserManual.pdf!)

Kind regards,

Frank
--
Dr.-Ing. Frank Mehnert | Software Development Director, VirtualBox
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany

Hauptverwaltung: Riesstr. 25, D-80992 M?nchen
Registergericht: Amtsgericht M?nchen, HRA 95603
Gesch?ftsf?hrer: J?rgen Kunz

Komplement?rin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Gesch?ftsf?hrer: Alexander van der Ven, Astrid Kepper, Val Maher
Taowei Luo
2014-06-02 16:00:21 UTC
Permalink
Thank you.
And the SDKRef.pdf is really useful to me.
Post by Frank Mehnert
Hi Taowei,
Post by Taowei Luo
Hi, I'm developing the vbox drivers for libvirt, with the vbox c api.
I have a question. Is there any type conflict in vbox C API between
different versions?
For example, I have a var type named nsresult. In some C API versions, It
defines nsresult as type PRUint32. Is it true that all nsresults (in
different versions) will be defined as the same type PRUint32?
I know it may be false for structs which have function pointers. But in
other cases, especially basic types, is the type compatible with all c
api
Post by Taowei Luo
versions?
nsresult is always PRUint32. Note that this code is always a status
code and will never include any pointer or similar. Values bigger
than 0x80000000 are used for errors, NS_OK is defined as 0.
In general, the API will not differ between VBox versions of the same
stable branch but the API might change with a new major release. For
example, VBox 4.3.2 and 4.3.4 have the same API while VBox 4.2.2 and
4.3.2 differ a bit. Usually the changes between different API versions
are small and all changes are documented in section 12 of the VirtualBox
SDK documentation (SDKRef.pdf, not UserManual.pdf!)
Kind regards,
Frank
--
Dr.-Ing. Frank Mehnert | Software Development Director, VirtualBox
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany
Hauptverwaltung: Riesstr. 25, D-80992 M?nchen
Registergericht: Amtsgericht M?nchen, HRA 95603
Gesch?ftsf?hrer: J?rgen Kunz
Komplement?rin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Gesch?ftsf?hrer: Alexander van der Ven, Astrid Kepper, Val Maher
_______________________________________________
vbox-dev mailing list
vbox-dev at virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20140603/5b8e491a/attachment.html
Klaus Espenlaub
2014-06-11 12:02:40 UTC
Permalink
Post by Taowei Luo
Thank you.
And the SDKRef.pdf is really useful to me.
Wondering if you're bumping into an accidental regression in the C API
overhaul a few months ago (made its debut in the SDK for VBox 4.3.8).
Can you provide a code snippet which suddenly started failing?

Our intention was to keep things 100% backwards compatible (no matter
how rotten the old C API programming style was, it's a lot nicer now,
see the updated sample code).

Klaus
Post by Taowei Luo
2014-06-02 21:52 GMT+08:00 Frank Mehnert <frank.mehnert at oracle.com
Hi Taowei,
Post by Taowei Luo
Hi, I'm developing the vbox drivers for libvirt, with the vbox c api.
I have a question. Is there any type conflict in vbox C API between
different versions?
For example, I have a var type named nsresult. In some C API
versions, It
Post by Taowei Luo
defines nsresult as type PRUint32. Is it true that all nsresults (in
different versions) will be defined as the same type PRUint32?
I know it may be false for structs which have function pointers.
But in
Post by Taowei Luo
other cases, especially basic types, is the type compatible with
all c api
Post by Taowei Luo
versions?
nsresult is always PRUint32. Note that this code is always a status
code and will never include any pointer or similar. Values bigger
than 0x80000000 are used for errors, NS_OK is defined as 0.
In general, the API will not differ between VBox versions of the same
stable branch but the API might change with a new major release. For
example, VBox 4.3.2 and 4.3.4 have the same API while VBox 4.2.2 and
4.3.2 differ a bit. Usually the changes between different API versions
are small and all changes are documented in section 12 of the VirtualBox
SDK documentation (SDKRef.pdf, not UserManual.pdf!)
Kind regards,
Frank
Loading...