Thanks for the reply Cedric,
wrappers is a dir that I made similar to examples which wraps the libvirt c code. The
reason why I am doing this is to simplify the usage of virConnectOpenAuth - it's
arguments and callbacks from JavaScript. Using ffi, I am unable to create the right
callbacks and have it pass the correct arguments.
I also followed a different approach of having my wrappers turned into a shared object
(.so) and linking libvirt.so as a dependency.
My environment is esx requiring authentication.
Much appreciated,
Vik.
On Feb 21, 2014, at 12:19 AM, Cedric Bosdonnat
<cbosdonnat(a)suse.com> wrote:
Hello Vik,
> On Thu, 2014-02-20 at 15:14 -0800, vikhyath reddy wrote:
> Thanks for libvirt. It is a life saver. I am in the process of writing
> some custom wrappers for libvirt so that it can be easily accessed
> from nodejs using the nodejs-ffi interfacing (basically describes a
> way to convert nodejs to c calls). I did write the wrapper on the
> lines of the examples provided. But I am unable to see my new
> functions in the libvirt.so file (which nodejs interfacing needs).
> Which means that my wrappers under <libvirt>/wrappers/ are not getting
> into libvirt.so like the ones at <libvirt>/examples
I don't quite get what you are doing. Why would you need to modify
libvirt to wrap it in a nodejs-based script? What is that
libvirt/wrappers folder you are mentioning? there is no such thing in
the libvirt repository.
From what I understood from the nodejs-ffi page, you should mostly write
javascript code similar to this:
------------ %< ------------
var ref = require('ref');
var ffi = require('ffi');
var virConnect = ref.types.void;
var virConnectPtr = ref.refType(virConnect);
var libvirt = ffi.Library('libvirt', {
'virInitialize': [ 'int', [ ] ],
'virConnectOpen': [virConnectPtr, [ string ]],
...
});
------------ %< ------------
I'm pretty sure generating this could be automated by a small program or
script or even a clang plugin, using include/libvirt/libvirt.h.in as
input.
> Can you please guide me as to where I am going wrong? I was able to do
> a successful configure + make and I thought this will regenerate the
> new libvirt.so (which it does, but I cant see my new wrapper methods
> in it).
I case you really want to modify libvirt, then you should proceed as
mentioned on this page:
http://libvirt.org/compiling.html
Regards,
--
Cedric