@Serenitor

Yes, it could be the lib of file that invoke some function when loaded and 
maybe that function has some blocking procedure.

In my test, I just simply made dummy function
    
    
    /*
     * compile with gcc in Windows (mingw64)
     * $ gcc -shared -o test.dll test.c
     *
     * in Linux (bash in Windows 10)
     * $ gcc -shared -fPIC -o test.so test.c
     */
    
    #ifdef _WIN32
    #include <windows.h>
    
    unsigned int sleep (unsigned int seconds) {
        Sleep(seconds * 1000); // Sleep needs in milliseconds while sleep needs 
in seconds
        return 0;
    }
    
    #elif defined __unix__
    #include <unistd.h>
    #endif
    
    int test() {
        sleep(10);  // this is blocking
        return 10;
    }
    

If you want to run/load the `test` function in Linux, somehow you have to 
hard-code the lib name to point to current directory (e.g. 
`loadlib("./test.so")`). I'm not sure why option `-L.` doesn't work. After 
looking around, you need to somehow edit LD_LIBRARY_PATH but since this is just 
test, that would be unnecessary 

Reply via email to