dlclose reports ENOENT with simple code

Yuyi Wang Strawberry_Str@hotmail.com
Sun Mar 30 09:32:44 GMT 2025


Code to reproduce:


#include <dlfcn.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

int main() {
     void* handle = dlopen("/usr/bin/cygwin1.dll", RTLD_LAZY | RTLD_LOCAL);
     if (!handle)
     {
         printf("dlopen: %s\n", dlerror());
         exit(1);
     }
     int res = dlclose(handle);
     if (res != 0)
     {
         printf("dlclose: %s\n", dlerror());
         exit(1);
     }
}


The program should succeed, but now it fails with "dlclose: No such file 
or directory".



More information about the Cygwin mailing list