Thanks a lot!
zhunxun@xxxxxxxxx
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 thatin some of our documentation? Even if you saw it in the sources, thecompiler has no way of knowing that because you haven't included thatstructure definition anywhere. That's because we don't expose it in anypublic header files. That way we can change it at any point in thefuture. And for callers to access it, we just expose a function to getthe 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