Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Path workaround for windows #226

Merged
merged 1 commit into from
Jun 11, 2024
Merged

Conversation

bolognam
Copy link
Contributor

@bolognam bolognam commented Jun 5, 2024

Copy link

@topolarity topolarity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth updating the README, if other users can confirm that this gets the newer versions of MATLAB working on Windows for them

It's likely that the macOS and Linux issues are similar, but they'll need separate fixes since each platform has a different search behavior for libraries.

@inkydragon
Copy link

Another choice is to modify the environment variables using withenv only when dlopen is called.

MATLAB.jl/src/MATLAB.jl

Lines 84 to 86 in f867397

libmx[] = Libdl.dlopen(joinpath(matlab_libpath, "libmx"), Libdl.RTLD_GLOBAL)
libmat[] = Libdl.dlopen(joinpath(matlab_libpath, "libmat"), Libdl.RTLD_GLOBAL)
libeng[] = Libdl.dlopen(joinpath(matlab_libpath, "libeng"), Libdl.RTLD_GLOBAL)

@topolarity
Copy link

That would have to wrap around every function call, because they can dynamically trigger additional LoadLibrary calls internally (which is exactly what engOpen does - the dlopen actually succeeds)

@musm
Copy link
Collaborator

musm commented Jun 6, 2024

I wonder if there is a less invasive approach as a bulk modification of the environment variable, as I think has the potential to corrupt other libraries.

@topolarity
Copy link

I believe that AddDllDirectory would be the primary alternative (jheinen/GR.jl#489 seemed to tread similar ground)

However, those directories won't be seen by a LoadLibraryW w/o flags like the one in MATLAB, which doesn't opt-in to the new search directories.

SetDefaultDllDir does change the LoadLibraryW behavior to use the added paths, but it's broken for e.g. SuiteSparse in Julia unless changes are made to Julia's library loading behavior: JuliaLang/julia#47775

@musm
Copy link
Collaborator

musm commented Jun 11, 2024

@topolarity I think we should explore that option in another PR. For now I will merge this since it at least allows us to use MATLAB. @bolognam do you mind also updating the readme?

@musm musm merged commit 3bd0547 into JuliaInterop:master Jun 11, 2024
3 checks passed
@bolognam bolognam deleted the issue-200 branch June 13, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants