Hacker News new | ask | show | jobs
by matheusmoreira 1681 days ago
Jesus. I wonder how much time it took to debug that...

Libaries shouldn't do anything unless called explicitly. Even when called, they should cede as much control as possible. They should probably be exposing the concurrent functions so the caller can decide how to thread them... Every time a library decides to make things easy for the user it leads to insane problems like these.

1 comments

Nah, it's a rather basic problem and the solution is well known: do another LoadLibrary on the already loaded library. Of course, then you need a Free­Library­AndExit­Thread... [0] And the posts following [0] (you can see them at the bottom of the page in the "Read Next" section) explain more of the context.

All this stuff is there because of the built-in threading support in COM which, arguably, was pretty convoluted for some rather strange reasons ― what's the point of such precise RAII-ing of the DLLs? I guess the address space was really precious back then or something.

[0] https://devblogs.microsoft.com/oldnewthing/20131105-00/?p=27...