Re: libvirt question

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

 



Thanks a lot!


zhunxun@xxxxxxxxx
 
From: Martin Kletzander
Date: 2017-05-19 14:16
To: zhunxun@xxxxxxxxx
CC: libvir-list
Subject: Re: libvirt question
On Fri, May 19, 2017 at 10:52:32AM +0800, zhunxun@xxxxxxxxx wrote:
>Hello,I wrote a program using libvirt API to get vm information like this:
>/*dom  is virDomainPtr type*/
>dom=virDomainLookupByID(conn,activeDomains[i]);
>if(dom!=NULL)
>    printf("%d    ----------%s\n",activeDomains[i],dom->name);
>......
>but when compile it,error occured like this:
>vm_eraser_detect.c:125:54: error: dereferencing pointer to incomplete type
>    printf("%d    ----------%s\n",activeDomains[i],dom->name);
>what is the reason of it???
>thanka a lot!
>
 
TL;DR s/dom->name/virDomainGetName(dom)/
 
Explanation:
Where did you get the idea that virDomainPtr has a name in it?  Is that
in some of our documentation?  Even if you saw it in the sources, the
compiler has no way of knowing that because you haven't included that
structure definition anywhere.  That's because we don't expose it in any
public header files.  That way we can change it at any point in the
future.  And for callers to access it, we just expose a function to get
the name.
 
>
>zhunxun@xxxxxxxxx
 
>--
>libvir-list mailing list
>libvir-list@xxxxxxxxxx
>https://www.redhat.com/mailman/listinfo/libvir-list
--
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]
  Powered by Linux