Skip to content

Library not working on Windows #21

@robinmaisch

Description

@robinmaisch

I was excited to try this library for an upcoming project; however, it appears that I am unable to use it as-is on Windows 11 x64.
These issues may also relate to #16.

After making a few adjustments, I was able to get it to work, and I wanted to share the necessary modifications with you, hoping that they might be incorporated into future testing or releases, or at least help other developers who are trying to use this library on Windows.

  1. Loading the Native Library
    NfdLibraryNative.kt copies the respective library to a temporary directory and renames it "libnfd". My system expects a file called "libnfd.dll" and is unable to find the file without the file extension; therefore, instead of using the filename constant NFD_OS_FILE_FILENAME (l. 31), I reused the variable filename, which contains the name of the original file, including its file extension. This works just fine for me.
  2. Incompatible Library
    Although the file libnfd_win.dll is built on a Windows server, I am unable to access any functions from it. An error occurs, indicating that NFD_INIT could not be found in the library. Using several tools to inspect the DLL file, I was unable to confirm that any valid functions are present in it. So, I compiled the nativefiledialog-extended library on my system using MinGW and the commands from your GitHub actions. After renaming the resulting DLL to libnfd_win.dll and placing it in src\resources, the program used this one instead of the original, and the appropriate functions were found.
  3. Incompatibilities in the expected behavior
    In NfdFileDialog.kt, the code expects the number of selected files to be a long on Windows systems (l. 89), but it is an integer on my system.
    Additionally, on my end, the native functions produce wide strings instead of regular strings, which leads to incorrect interpretation of the transmitted data – only one character is read (l. 119, l. 173).

Lastly, for your fork of nativelibrarydialog-extended, my version of CMake refused to compile it due to the outdated minimal version (3.2) given in CMakeLists.txt, which was already addressed in the original repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions