Skip to content

Load dynamically libjulia.dll fails on Win32 from python and LoadLibrary? #57246

Open
@Nelson-numerical-software

Description

Code below works on windows x86_64 but not on windows x86

Minimal code:

import os
import ctypes
julia_directory = 'D:/julia-1.11.3-win32/julia-1.11.3/bin'
os.chdir(julia_directory)
print("Current Directory:", os.getcwd())
julia_dll = 'libjulia.dll'
library_path = os.path.abspath(julia_dll)
julia_library = ctypes.CDLL(library_path)

result on windows x86:

D:\Developpements\Github\nelson-lang\nelson>python
Python 3.13.1 (tags/v3.13.1:0671451, Dec  3 2024, 19:06:28) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import ctypes
>>> julia_directory = 'D:/julia-1.11.3-win32/julia-1.11.3/bin'
>>> os.chdir(julia_directory)
>>> print("Current Directory:", os.getcwd())
Current Directory: D:\julia-1.11.3-win32\julia-1.11.3\bin
>>> julia_dll = 'libjulia.dll'
>>> library_path = os.path.abspath(julia_dll)
>>> julia_library = ctypes.CDLL(library_path)
Traceback (most recent call last):
  File "<python-input-7>", line 1, in <module>
    julia_library = ctypes.CDLL(library_path)
  File "C:\WindowsTools\Python313\Lib\ctypes\__init__.py", line 390, in __init__
    self._handle = _dlopen(self._name, mode)
                   ~~~~~~~^^^^^^^^^^^^^^^^^^
OSError: [WinError 193] %1 nest pas une application Win32 valide
>>

Julia version downloaded from https://julialang-s3.julialang.org/bin/winnt/x86/1.11/julia-1.11.3-win32.zip

from C++ code with MSVC 2022 win32 build as compiler LoadLibrary fails with error:

Unable to load dependent library D:\julia-1.11.3-win32\julia-1.11.3\bin\libjulia-codegen.dll

Same code with x64 build and julia x64 works perfectly.

Do not hesitate to close it if it is a duplicated bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions