[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xenctrl: Make the headers C++ friendly



On 07/03/14 07:08, Razvan Cojocaru wrote:
> On 07/03/2014 01:56 PM, George Dunlap wrote:
>> On Wed, Jul 2, 2014 at 5:30 PM, Razvan Cojocaru
>> <rcojocaru@xxxxxxxxxxxxxxx> wrote:
>>> Moved an enum definition before the typedef that uses it.
>> Presumably you want this because you have an out-of-tree program that
>> you want to compile against libxc.  You do realize that libxc isn't a
>> stable API, right?  That it may change in incompatible ways in every
>> release?
> Yes, I've glimpsed into that by following it since Xen 4.1.
> I am indeed compiling an application against libxc.

I also have one that is both libxc and libxl in c++.  I fixed it by 
moving the
typedef:



diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
index 13f816b..37031ad 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -119,7 +119,6 @@ typedef struct xc_interface_core xc_interface;
  typedef struct xc_interface_core xc_evtchn;
  typedef struct xc_interface_core xc_gnttab;
  typedef struct xc_interface_core xc_gntshr;
-typedef enum xc_error_code xc_error_code;


  /*
@@ -1756,14 +1755,14 @@ int xc_hvm_inject_trap(
   */


-enum xc_error_code {
+typedef enum xc_error_code {
    XC_ERROR_NONE = 0,
    XC_INTERNAL_ERROR = 1,
    XC_INVALID_KERNEL = 2,
    XC_INVALID_PARAM = 3,
    XC_OUT_OF_MEMORY = 4,
    /* new codes need to be added to xc_error_level_to_desc too */
-};
+} xc_error_code;

  #define XC_MAX_ERROR_MSG_LEN 1024
  typedef struct xc_error {


So I would like to see either of these done.

>> I presume you'd rather use a stable API -- in which case maybe we
>> should ask what it is your application needs, and we can try to come
>> up with a way to support you.  (Perhaps by declaring certain parts of
>> the libxc interface as "stable", if libxl isn't suitable for some
>> reason.)


I have no need for a stable API; but it might allow the C++ code to not
include this file from /usr/include/xenctrl.h


    -Don Slutz

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.