Skip to content

Commit b6077a5

Browse files
committed
Add missing sqlite3.dll
1 parent 80d689a commit b6077a5

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

Source/PythonPluginPreload/Private/PythonPluginPreload.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,31 @@ class FPythonPluginPreload : public IModuleInterface
2626
});
2727

2828
// Load python library
29-
FString PluginDir = IPluginManager::Get().FindPlugin(TEXT("UnrealEnginePython"))->GetBaseDir();
30-
FString PythonDir = FString::Printf(TEXT("Python%d%d"), PY_MAJOR_VERSION, PY_MINOR_VERSION);
29+
const FString PluginDir = IPluginManager::Get().FindPlugin(TEXT("UnrealEnginePython"))->GetBaseDir();
30+
const FString PythonDir = FString::Printf(TEXT("Python%d%d"), PY_MAJOR_VERSION, PY_MINOR_VERSION);
3131

3232
#if PLATFORM_WINDOWS
33-
FString DllFilename = FString::Printf(TEXT("python%d%d.dll"), PY_MAJOR_VERSION, PY_MINOR_VERSION);
34-
FString DllPath = PluginDir / TEXT("ThirdParty") / PythonDir / TEXT("bin/win64") / DllFilename;
35-
PythonHandle = LoadDll(DllPath);
33+
const FString DllDir = PluginDir / TEXT("ThirdParty") / PythonDir / TEXT("bin/win64");
34+
const FString DllFilename = FString::Printf(TEXT("python%d%d.dll"), PY_MAJOR_VERSION, PY_MINOR_VERSION);
35+
PythonHandle = LoadDll(DllDir / DllFilename);
36+
SqliteHandle = LoadDll(DllDir / TEXT("sqlite3.dll"));
3637
#elif PLATFORM_LINUX
37-
FString DllFilename = FString::Printf(TEXT("libpython%d%d.so"), PY_MAJOR_VERSION, PY_MINOR_VERSION);
38-
FString DllPath = PluginDir / TEXT("ThirdParty") / PythonDir / TEXT("bin/linux") / DllFilename;
39-
PythonHandle = LoadDll(DllPath);
38+
const FString DllDir = PluginDir / TEXT("ThirdParty") / PythonDir / TEXT("bin/linux");
39+
const FString DllFilename = FString::Printf(TEXT("libpython%d%d.so"), PY_MAJOR_VERSION, PY_MINOR_VERSION);
40+
PythonHandle = LoadDll(DllDir / DllFilename);
41+
SqliteHandle = LoadDll(DllDir / TEXT("sqlite3.dll"));
4042
#endif
4143
}
4244

4345
virtual void ShutdownModule() override
4446
{
4547
FPlatformProcess::FreeDllHandle(PythonHandle);
48+
FPlatformProcess::FreeDllHandle(SqliteHandle);
4649
}
4750

4851
private:
4952
void* PythonHandle = nullptr;
53+
void* SqliteHandle = nullptr;
5054
};
5155

5256
IMPLEMENT_MODULE(FPythonPluginPreload, PythonPluginPreload)

Source/UnrealEnginePython/UnrealEnginePython.Build.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ public UnrealEnginePython(TargetInfo Target)
127127
PublicAdditionalLibraries.Add(libPath);
128128

129129
string dllFilename = string.Format("python{0}{1}.dll", PythonVersionMajor, PythonVersionMinor);
130-
string dllPath = Path.Combine(PythonDir, "bin", "win64", dllFilename);
130+
string dllDir = Path.Combine(PythonDir, "bin", "win64");
131+
string dllPath = Path.Combine(dllDir, dllFilename);
131132
System.Console.WriteLine("Dll path: " + dllPath);
132133
RuntimeDependencies.Add(dllPath);
134+
RuntimeDependencies.Add(Path.Combine(dllDir, "sqlite3.dll"));
133135
}
134136
else if (Target.Platform == UnrealTargetPlatform.Mac)
135137
{
@@ -147,10 +149,12 @@ public UnrealEnginePython(TargetInfo Target)
147149
PublicAdditionalLibraries.Add(libPath);
148150

149151
string dllFilename = string.Format("libpython{0}{1}.so", PythonVersionMajor, PythonVersionMinor);
150-
string dllPath = Path.Combine(PythonDir, "bin", "linux", dllFilename);
152+
string dllDir = Path.Combine(PythonDir, "bin", "linux");
153+
string dllPath = Path.Combine(dllDir, dllFilename);
151154
System.Console.WriteLine("Dll path: " + dllPath);
152155
PublicAdditionalLibraries.Add(dllPath);
153156
RuntimeDependencies.Add(dllPath);
157+
RuntimeDependencies.Add(Path.Combine(dllDir, "sqlite3.dll"));
154158
}
155159
#if WITH_FORWARDED_MODULE_RULES_CTOR
156160
else if (Target.Platform == UnrealTargetPlatform.Android)

0 commit comments

Comments
 (0)