From 0d6cdac21e764af74a89d777bbd0acd29832256d Mon Sep 17 00:00:00 2001 From: Victor Milovanov Date: Sun, 7 Mar 2021 16:35:48 -0800 Subject: [PATCH] suggest to set Runtime.PythonDLL when embedding in .NET --- src/runtime/runtime.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/runtime/runtime.cs b/src/runtime/runtime.cs index a8d861770..b779c6707 100644 --- a/src/runtime/runtime.cs +++ b/src/runtime/runtime.cs @@ -2518,7 +2518,19 @@ static Delegates() } static global::System.IntPtr GetFunctionByName(string functionName, global::System.IntPtr libraryHandle) - => libraryLoader.GetFunction(libraryHandle, functionName); + { + try + { + return libraryLoader.GetFunction(libraryHandle, functionName); + } + catch (MissingMethodException e) when (libraryHandle == IntPtr.Zero) + { + throw new MissingMethodException( + "Did you forget to set Runtime.PythonDLL?" + + " See https://github.com/pythonnet/pythonnet#embedding-python-in-net", + e); + } + } internal static delegate* unmanaged[Cdecl] PyDictProxy_New { get; } internal static delegate* unmanaged[Cdecl] Py_IncRef { get; } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy