From: Razvan Cojocaru <rzvncj@gmail.com>
To: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Xen tools (libxs, xenstore) and C++
Date: Tue, 22 Jan 2013 17:16:56 +0200 [thread overview]
Message-ID: <50FEAD68.1000604@gmail.com> (raw)
Hello,
I'd like to use xenctrl.h and a handful of other headers in a C++
application. The headers I'm interested now are xenctrl.h,
xen/hvm/save.h, xen/mem_event.h and xenstore.h. Unfortunately, they're
not C++-friendly.
Here's why:
1. None of the headers enclose their contents in:
#ifdef __cplusplus
extern "C" {
#endif
/* contents here */
#ifdef __cplusplus
}
#endif
2. xen/arch-x86/hvm/save.h uses the C++ keyword 'new' as a parameter
name (quite a few times).
3. C++ (being type-safer) frowns upon such assignments as:
struct hvm_hw_cpu *newcpu=h; // h is void*
which should be explicitly written as:
struct hvm_hw_cpu *newcpu=(struct hvm_hw_cpu *)h;
4. xenctrl.h typedefs "enum xc_error_code xc_error_code;" _before_ "enum
xc_error_code { /* ... */ }" has been defined, which C++ doesn't allow.
I'm also getting:
/usr/include/xen/mem_event.h:71:1: error: expected ‘;’ after union
definition
/usr/include/xen/mem_event.h:71:1: error: expected ‘:’ before ‘;’ token
where the DEFINE_RING_TYPES(mem_event, mem_event_request_t,
mem_event_response_t); macro is being expanded in mem_event.h.
Are there plans to have the userspace libraries be friendlier to C++?
Thanks,
Razvan Cojocaru
next reply other threads:[~2013-01-22 15:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-22 15:16 Razvan Cojocaru [this message]
2013-01-22 15:26 ` Xen tools (libxs, xenstore) and C++ Andrew Cooper
2013-01-22 15:35 ` Razvan Cojocaru
2013-01-22 15:36 ` Razvan Cojocaru
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50FEAD68.1000604@gmail.com \
--to=rzvncj@gmail.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.