forked from lmbelo/python4delphi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuMain.pas
More file actions
42 lines (30 loc) · 770 Bytes
/
uMain.pas
File metadata and controls
42 lines (30 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
unit uMain;
interface
uses PythonEngine, WrapDelphi, WrapDelphiVCL;
function PyInit_Delphi: PPyObject; cdecl;
var
gEngine : TPythonEngine;
gModule : TPythonModule;
gDelphiWrapper : TPyDelphiWrapper;
implementation
function PyInit_Delphi: PPyObject;
begin
try
gEngine := TPythonEngine.Create(nil);
gEngine.AutoFinalize := False;
gModule := TPythonModule.Create(nil);
gModule.Engine := gEngine;
gModule.ModuleName := 'Delphi';
gDelphiWrapper := TPyDelphiWrapper.Create(nil);
gDelphiWrapper.Engine := gEngine;
gDelphiWrapper.Module := gModule;
gEngine.LoadDll;
except
end;
Result := gModule.Module;
end;
initialization
finalization
gEngine.Free;
gModule.Free;
end.