Converting .so file of linux to a .dll file of windows

12,136

No. You will need to recompile the library for Windows.

Share:
12,136
Ashish kulkarni
Author by

Ashish kulkarni

Updated on July 20, 2022

Comments

  • Ashish kulkarni
    Ashish kulkarni almost 2 years

    I have some C code (having various header files and a make file) compiled as a .so file in Linux(Ubuntu) and a python program which calls the functions of this shared object using Ctypes. Now, I want to use this program on windows. In windows, Ctypes needs a .dll file instead of .so in linux.

    So, is there a way in which I can convert the .so files of linux into .dll files to be used with Ctypes in Windows ?

  • Eryk Sun
    Eryk Sun almost 9 years
    The section on Linking Against DLLs has nothing to do with the OP's requirements. He has an .so file, which is completely useless with Windows Python, and thus he absolutely must follow your first recommendation to recompile and relink as a Windows DLL. He's not trying to generate a Cygwin or MinGW compatible import library from an existing DLL.
  • uraimo
    uraimo almost 9 years
    Correct, i just scrolled through the text, my bad, reference removed.
  • Ashish kulkarni
    Ashish kulkarni almost 9 years
    @uraimo: Thanks. I will try the dlltool. Alternatively I was trying installing mingw on linux and compiling the code into a dll to be used on windows. Will that work ?
  • uraimo
    uraimo almost 9 years
    Yes, you should be able to do that ("crosscompiling", alternatively use mingw on windows).
  • Admin
    Admin over 8 years
    I've removed the reference to dlltool entirely, as it's not an alternative to recompilation.
  • Roni Hoffman
    Roni Hoffman over 8 years
    Sorry, little confused, how would I recompile a .so file on windows to get a .dll if I dont have the source code, just the .so?