Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdb765ca

Browse files
committed
suggest to set Runtime.PythonDLL when embedding in .NET
1 parentf2dc8f1 commitdb765ca

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎src/runtime/runtime.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2518,7 +2518,19 @@ static Delegates()
25182518
}
25192519

25202520
staticglobal::System.IntPtrGetFunctionByName(stringfunctionName,global::System.IntPtrlibraryHandle)
2521-
=>libraryLoader.GetFunction(libraryHandle,functionName);
2521+
{
2522+
try
2523+
{
2524+
returnlibraryLoader.GetFunction(libraryHandle,functionName);
2525+
}
2526+
catch(MissingMethodExceptione)when(libraryHandle==IntPtr.Zero)
2527+
{
2528+
thrownewMissingMethodException(
2529+
"Did you forget to set Runtime.PythonDLL?"+
2530+
" See https://github.com/pythonnet/pythonnet#embedding-python-in-net",
2531+
e);
2532+
}
2533+
}
25222534

25232535
internalstaticdelegate* unmanaged[Cdecl]<IntPtr,IntPtr>PyDictProxy_New{get;}
25242536
internalstaticdelegate* unmanaged[Cdecl]<IntPtr,void>Py_IncRef{get;}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp