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

Re: [libvirt] [RFC] Version numbers outside of releases



On Thu, 2017-06-01 at 12:21 +0100, Daniel P. Berrange wrote:
> This is not that attractive from POV the language bindings.
> 
> eg in the Go code, I need to make usage of the new APIs
> conditional at compile time. For example for the new APIs
> added in 3.4.0 I have code like
> 
>   func (v *Stream) RecvFlags(p []byte, flags StreamRecvFlagsValues) (int, error) {
>         if C.LIBVIR_VERSION_NUMBER < 3004000 {
>                 return 0, GetNotImplementedError("virStreamRecvFlags")
>         }
> 
>         n := C.virStreamRecvFlagsCompat(v.ptr, (*C.char)(unsafe.Pointer(&p[0])), C.size_t(len(p)), C.uint(flags))
> 
>         ...snip...
>   }
> 
> and 
> 
>   int virStreamRecvFlagsCompat(virStreamPtr st,
>                                char *data,
>                                size_t nbytes,
>                                unsigned int flags)
>   {
>   #if LIBVIR_VERSION_NUMBER < 3004000
>       assert(0); // Caller should have checked version
>   #else
>       return virStreamRecvFlags(st, data, nbytes, flags);
>   #endif
>   }
> 
> The suggested versioning scheme would require changing all these version
> numbers checks to 3003090 is rather unpleasant IMHO.

Well, that shouldn't be needed for released versions of the
bindings as they would of course depend on a released version
of libvirt, but I see how it would make it more difficult
than necessary to develop the bindings in parallel to the new
libvirt version.

So I guess disregard my proposal :)

-- 
Andrea Bolognani / Red Hat / Virtualization


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