←back to thread

39 points mattrighetti | 1 comments | | HN request time: 0s | source
Show context
sgbeal ◴[] No.45074556[source]
There is no safe, reliable, cross-environment way to deal with closing a DLL. A DLL initialization function can allocate arbitrary resources, some of which may be in use by clients of the DLL when it is closed.

The only safe, consistent, reliable approach is not to close DLLs.

replies(6): >>45074649 #>>45074720 #>>45075478 #>>45075558 #>>45075726 #>>45080214 #
immibis ◴[] No.45075558[source]
There is no safe, reliable, cross-environment way to deal with deallocating memory. A memory block can be referenced from arbitrary locations, some of which may be on the stack by clients of the memory block when it isndeallocated.

The only safe, consistent, reliable approach is not to deallocate memory.

replies(3): >>45075570 #>>45076060 #>>45077479 #
SkiFire13 ◴[] No.45076060[source]
The difference is that memory won't do anything under your nose, it can't run arbitrary code by itself. It won't spawn threads, create thread locals, or store data in global variables. And it's normal to track the lifetime of memory, much less the lifetime of code and function pointers passed around.
replies(2): >>45077149 #>>45078799 #
1. AstralStorm ◴[] No.45078799[source]
You could do that, but then you're running valgrind.