Re: [libvirt-users] C API example

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

 



On Thu, Jul 01, 2010 at 01:43:55PM -0700, steven765@xxxxxxxxx wrote:
> Hi Dave, 
>    Thanks for the reply after getting some sleep the question I should have asked is what libraries do I need to link the application against?  If I just try gcc -o a.out hellolibvirt.c it can't find any of the libvirt calls.

[cc'ing the list again so the answer gets archived]

Libvirt's no different from any other library, you need to link
against libvirt, and you need to have the libvirt headers installed.
On Fedora, that's:

yum install libvirt-devel

If you want to build hellolibvirt without using make, you'll need to
edit hellolibvirt.c and take out config.h, which is unused.  Then you
can do:

gcc -o hellolibvirt -lvirt hellolibvirt.c

Then you just need to learn the API and decide what you want to do
with it. ;-)

The API is documented at:

http://libvirt.org/html/libvirt-libvirt.html

Dave



> Thanks,
> Steve
> 
> --- On Thu, 7/1/10, Dave Allan <dallan@xxxxxxxxxx> wrote:
> 
> > From: Dave Allan <dallan@xxxxxxxxxx>
> > Subject: Re: [libvirt-users] C API example
> > To: steven765@xxxxxxxxx
> > Cc: "Justin Clift" <justin@xxxxxxxxxxxx>, libvirt-users@xxxxxxxxxx
> > Date: Thursday, July 1, 2010, 2:06 PM
> > On Wed, Jun 30, 2010 at 07:37:27PM
> > -0700, steven765@xxxxxxxxx
> > wrote:
> > > I think so, but I'm locked out at home. I'll have to
> > try at school tomorrow.  It gave me a remote error, but
> > with the correct directory so fingers crossed thanks! 
> > 
> > > 
> > > btw might you or anyone know what I have to include to
> > start a clean project of my own?  So if I want to just
> > build an application that uses the API with nothing else but
> > what's necessary?
> > 
> > If you're talking about a C application, you're pretty much
> > describing
> > hellolibvirt.  I tried to put enough in there to
> > demonstrate a couple
> > of different calls, but hopefully not so much that it's
> > overwhelming.
> > If it seems like there's a lot there, cut some of it
> > out.  You don't
> > need the showDomains function, for example.  Remove
> > it, compile and
> > see what happens.
> > 
> > Dave
> > 
> > 
> > > Thanks,
> > > Steve
> > > 
> > > --- On Wed, 6/30/10, Justin Clift <justin@xxxxxxxxxxxx>
> > wrote:
> > > 
> > > > From: Justin Clift <justin@xxxxxxxxxxxx>
> > > > Subject: Re: [libvirt-users] C API example
> > > > To: "Dave Allan" <dallan@xxxxxxxxxx>
> > > > Cc: steven765@xxxxxxxxx,
> > libvirt-users@xxxxxxxxxx
> > > > Date: Wednesday, June 30, 2010, 10:09 PM
> > > > On 07/01/2010 11:54 AM, Dave Allan
> > > > wrote:
> > > > <snip>
> > > > > ./hellolibvirt \
> > > > >
> > > >
> > qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock
> > > > 
> > > > Thanks Dave.  The +unix:// and ?socket=xxx bits
> > are
> > > > what I'd not been picking up on.  Should be good
> > now.
> > > > 
> > > > Steven, is it working for you?
> > > > 
> > > > Regards and best wishes,
> > > > 
> > > > Justin Clift
> > > > 
> > > > -- Salasaga  -  Open Source eLearning IDE
> > > >               http://www.salasaga.org
> > > > 
> > > 
> > > 
> > > 
> > 
> 
> 
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]