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

Thomas Guillem thomas at gllm.fr
Wed May 22 10:44:11 CEST 2019


 I don't really care about UB, it was there for a reason and it's still used. If you want to remove it, start a discussion on the ML. 

On Wed, May 22, 2019, at 10:28, Steve Lhomme wrote:
> On 2019-05-22 10:03, Rémi Denis-Courmont wrote:
> > The app cannot even load LibVLC if it does not agree on the CRT or does 
> 
> The LoadLibrary() of Windows loads the depending DLLs, including the 
> language runtime this DLL needs to run. For example libvlc.dll will load 
> msvcrt.dll automatically.
> 
> That doesn't mean the language calling LoadLibray() has to use this CRT 
> at all.
> 
> What you are proposing is that an app using libvlc.dll must also do a 
> LoadLibrary(msvcrt.dll), GetProcAddress(free) so it can call free. It 
> becomes impossible is the C runtime is linked statically. It's not 
> possible to do GetProcAddress(free) as it's not exposed by libvlc.dll.
> 
> > not use any CRT. The question therefore makes no sense: the app already 
> > has free() and other tied functions available from the agreed-upon CRT.
> > 
> > libvlc_free() is just a foot gun that makes it look like you don't need 
> > to care about the CRT, when you in fact do.
> 
> No, that's a way for any language to call the proper free() without 
> having to deal with a C runtime at all.
> 
> > Le 22 mai 2019 10:59:35 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
> > 
> >     On 2019-05-22 9:49, Rémi Denis-Courmont wrote:
> > 
> >         As I *already* noted, and as is widely documented outside.
> > 
> >         On most platforms, C runtime is per process. On Windows, it's per
> >         thread. Either way, the consequence is that the mere fact of
> >         calling the
> >         CRT from within LibVLC functions ties the CRT of LibVLC and the
> >         calling
> >         code.
> > 
> > 
> >     I agree with that. It doesn't mean the host app has to take care of it
> >     if the language doesn't know about using C code and the libvlc DLL
> >     loading is done manually. libvlc_free() allowed this use.
> > 
> >     free() is not exposed by libvlc, so how would an external app not
> >     written in C know where to find that free() call ? (which hopefully is
> >     not a macro to another runtime call)
> > 
> >         Le 22 mai 2019 10:20:06 GMT+03:00, Steve Lhomme
> >         <robux4 at ycbcr.xyz> a écrit :
> > 
> >         On 2019-05-20 14:15, Rémi Denis-Courmont wrote:
> > 
> >         Hi,
> > 
> >         There are no changes to the fact that LibVLC "leaks" the C runtime.
> > 
> > 
> >         Where does it leak the C runtime ? I can understand the C ABI,
> >         but not
> >         the C runtime. It's possible to load the DLL just knowing the
> >         ABI and
> >         never touch the runtime or have to know about it.
> > 
> >         There's a difference between being tied to a C runtime and having to
> >         link to it from any other language using libvlc.
> > 
> >         On most systems, you cannot mix runtimes in a process at all due to
> >         namespace conflicts. On Windows, you have to stick to Win32 API
> >         calls on
> >         threads created by another runtime - something LibVLC does not do.
> > 
> >         Le 20 mai 2019 15:08:39 GMT+03:00, Steve Lhomme
> >         <robux4 at ycbcr.xyz> a écrit :
> > 
> >         On 2019-05-20 13:24, Rémi Denis-Courmont wrote:
> > 
> >         Hi,
> > 
> >         No changes there.
> > 
> > 
> >         I can see a patch makind changes in the code. You'll have to be more
> >         specific.
> > 
> >         This is consistent with the existing doc and the reality.
> > 
> > 
> >         You removed the documentation that specifically explained one
> >         case where
> >         using libvlc_free() was actually necessary.
> > 
> >         This comes from vlc.git.
> >         -- 
> >         Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez
> >         excuser
> >         ma brièveté.
> >         ------------------------------------------------------------------------
> >         vlc-devel mailing list
> >         To unsubscribe or modify your subscription options:
> >         https://mailman.videolan.org/listinfo/vlc-devel
> >         ------------------------------------------------------------------------
> >         vlc-devel mailing list
> >         To unsubscribe or modify your subscription options:
> >         https://mailman.videolan.org/listinfo/vlc-devel
> > 
> > 
> >         -- 
> >         Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez
> >         excuser
> >         ma brièveté.
> >         ------------------------------------------------------------------------
> >         vlc-devel mailing list
> >         To unsubscribe or modify your subscription options:
> >         https://mailman.videolan.org/listinfo/vlc-devel
> >         ------------------------------------------------------------------------
> >         vlc-devel mailing list
> >         To unsubscribe or modify your subscription options:
> >         https://mailman.videolan.org/listinfo/vlc-devel
> > 
> > 
> >         -- 
> >         Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez
> >         excuser
> >         ma brièveté.
> >         ------------------------------------------------------------------------
> >         vlc-devel mailing list
> >         To unsubscribe or modify your subscription options:
> >         https://mailman.videolan.org/listinfo/vlc-devel
> > 
> >     ------------------------------------------------------------------------
> >     vlc-devel mailing list
> >     To unsubscribe or modify your subscription options:
> >     https://mailman.videolan.org/listinfo/vlc-devel
> > 
> > 
> > -- 
> > Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser 
> > ma brièveté.
> > 
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> > 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list