dladdr and dll refcount

Jeremy Drake cygwin@jdrake.com
Sat Apr 5 15:53:55 GMT 2025


On Sat, 5 Apr 2025, Jon Turney wrote:
> On 05/04/2025 06:28, Jeremy Drake via Cygwin wrote:
> > I just happened to look at dlfcn.cc dladdr function, and I had a question.
> > Should dladdr be using the GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
> > flag? It doesn't seem like dladdr should be incrementing the refcount.
>> Indeed. Well spotted.
>> This looks like my mistake back in commit
> c8432a01c8401c121940c806a9d868c4adc4cefd
>> Assuming that flag is available on all applicable Windows versions, it
> certainly looks like we should be using it (otherwise, I guess we just
> immediately free the handle).

This function (and flag) go back to XP. (I remember this because I was
irked about not being able to use it, the company I worked for was
supporting old windows versions well past their sell-by date). I'll send
a patch.


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /