Opened 19 years ago

Closed 19 years ago

#57 closed defect (invalid)

Dynamic libraries cannot be freed when sockets (at least) are used

Reported by: Yuri Dario Owned by: bird
Priority: low Milestone: libc-0.6.2
Component: libc Version: 0.6
Severity: minor Keywords: not-a-bug
Cc:

Description

When a dll uses a socket function (but not only in this case), the dll cannot be unloaded by DosFreeModule(), usually rc=12 (ERROR_INVALID_ACCESS) is returned. This leaves the dll file locked by the process, and it can be replaced only after process end (unlocking the dll is not enough, the current process will still use the old dll).

Sample code included in the attachment (source and binaries).

Attachments (1)

LoadMod.zip (9.5 KB ) - added by Yuri Dario 19 years ago.

Download all attachments as: .zip

Change History (2)

by Yuri Dario, 19 years ago

Attachment: LoadMod.zip added

comment:1 by bird, 19 years ago

Keywords: not-a-bug added
Resolution: invalid
Status: newclosed

This is not an error, and it has nothing to do with GCC.

This problem shows up when using VAC308 and toolkit headers. When thinking it over, the problem the following: tcpip32.dll has an exit list. It's loaded indirectly when DosLoadModule'ing mydll.dll. So, when trying to unload mydll tcpip32.dll should be unloaded as well. But, since tcpip32.dll has an exit list handler, it cannot be unloaded and DosFreeModule returns the typical ERROR_INVALID_ACCESS.

(To work around it, DosLoadModule any dll with exit list handlers directly before/after.)

Note: See TracTickets for help on using tickets.