Skip to content

Commit 636767b

Browse files
committed
Including the shared library file name in the moduledefs file
1 parent 2481056 commit 636767b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Modules/DelphiFMX/uMain.pas

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,18 @@ function TryLoadVerFromModuleDefs(): boolean;
7777
gEngine.DllPath := LPythonLib;
7878
end;
7979

80+
var LPythonSharedLib := String.Empty;
81+
if LJson.TryGetValue<string>('python_shared_lib', LPythonSharedLib) then begin
82+
gEngine.DllName := LPythonSharedLib;
83+
end;
84+
8085
var LPythonVer: string;
8186
if LJson.TryGetValue<string>('python_ver', LPythonVer) then begin
8287
for var I := Low(PYTHON_KNOWN_VERSIONS) to High(PYTHON_KNOWN_VERSIONS) do begin
8388
if (PYTHON_KNOWN_VERSIONS[I].RegVersion = LPythonVer) then begin
8489
gEngine.RegVersion := PYTHON_KNOWN_VERSIONS[I].RegVersion;
85-
gEngine.DllName := PYTHON_KNOWN_VERSIONS[I].DllName;
90+
if LPythonSharedLib.IsEmpty() then
91+
gEngine.DllName := PYTHON_KNOWN_VERSIONS[I].DllName;
8692
Dump(Format('Module has been set to Python %s using the module defs file', [gEngine.RegVersion]));
8793
Exit(true);
8894
end;
@@ -126,13 +132,14 @@ function PyInit_DelphiFMX: PPyObject;
126132
gDelphiWrapper.Module := gModule;
127133

128134
gEngine.LoadDll;
135+
Result := gModule.Module;
129136
except
130137
on E: Exception do begin
131138
WriteLn('An error occurred: ' + E.Message);
132139
Dump(E.Message);
140+
Result := gEngine.ReturnNone;
133141
end;
134142
end;
135-
Result := gModule.Module;
136143
end;
137144

138145
initialization

0 commit comments

Comments
 (0)