[vlc-devel] [vlc-commits] Remove libvlc_free

Jeremy Vignelles jeremy.vignelles at dev3i.fr
Thu May 23 09:23:06 CEST 2019


> > I don't understand how calling a function (libvlc_free()), which happens
> > to just call free(), is undefined behavior.
> 
> In the trivial/normal case, all threads in the process are initialized for the 
> same C run-time, and libvlc_free() is just a useless indirection to free().
> 
> UB can occur if there are more than one C run-time in a process though, or if 
> you use LibVLC on a non-C/C++ thread.

Do you mean that when calling free() on an object, we should always return to the thread that created the allocation to avoid that undefined behavior?

> But as far as running CIL code is concerned, this is far from sufficient to 
> address C run-time concerns. It's just far far easier to write a dedicated 
> native wrapper library that only exposes CIL-supported types, mainly fixed-size 
> fixed-signedness integers, arrays of integers and opaque pointers.

If I understand correctly, your concern is about marshalling C's `int` which has different sizes depending on the target platform? If so, I'll take a look at it again, but that seems doable in pure C#.

I don't understand your concerns about signedness : Do you mean that C have types that are sometime signed and other times unsigned? As far as libvlc is concerned, do you sometimes pass negative values in such types?


More information about the vlc-devel mailing list