8000 Drop LoadLibrary by amos402 · Pull Request #880 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

Drop LoadLibrary #880

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

Closed
wants to merge 14 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rollback symbol loading for __Internal
  • Loading branch information
amos402 committed Dec 15, 2019
commit 65e209e00d76a39007b86b4a3c825ab1e38a1d2c
19 changes: 11 additions & 8 deletions src/runtime/runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1946,15 +1946,15 @@ internal static IntPtr PyMem_Realloc(IntPtr ptr, long size)

internal static void SetNoSiteFlag()
{
if (_PythonDll == "__Internal")
{
throw new NotSupportedException("SetNoSiteFlag didn't support on static compile");
}
var loader = LibraryLoader.Get(OperatingSystem);
IntPtr dllLocal = loader.Load(_PythonDll);
if (dllLocal == IntPtr.Zero)
IntPtr dllLocal;
if (_PythonDll != "__Internal")
{
throw new Exception($"Cannot load {_PythonDll}");
dllLocal = loader.Load(_PythonDll);
if (dllLocal == IntPtr.Zero)
{
throw new Exception($"Cannot load {_PythonDll}");
}
}
try
{
Expand All @@ -1963,7 +1963,10 @@ internal static void SetNoSiteFlag()
}
finally
{
loader.Free(dllLocal);
if (dllLocal != IntPtr.Zero)
{
loader.Free(dllLocal);
}
}
}
}
Expand Down
0