summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-22 00:15:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-22 00:15:20 +0300
commit77a0dc234e1925173a8944e9e641d72d9fe39aba (patch)
treef9b053818a579cc2f9f63ab964d546532403d582 /include
parent7f37f113f29dfba362269266be7c751aaf87851f (diff)
awful crutch for Pascal plugins to use pseudo-constructor a la CMPlugin
Diffstat (limited to 'include')
-rw-r--r--include/delphi/m_api.pas19
-rw-r--r--include/delphi/m_helpers.inc3
-rw-r--r--include/delphi/m_langpack.inc4
3 files changed, 22 insertions, 4 deletions
diff --git a/include/delphi/m_api.pas b/include/delphi/m_api.pas
index 70d52c39af..21b2a365ac 100644
--- a/include/delphi/m_api.pas
+++ b/include/delphi/m_api.pas
@@ -140,6 +140,16 @@ type
true : (uuid :MUUID); // plugin's unique identifier
end;
+type
+ PCMPlugin = ^CMPlugin;
+ CMPlugin = record
+ m_hInst : THANDLE;
+ m_szModule : PAnsiChar;
+ m_pInfo : PPLUGININFOEX;
+ m_hLogger : THANDLE;
+ m_hLang : int;
+ end;
+
//----- Fork enchancement -----
{
Miranda/System/LoadModule event
@@ -180,6 +190,7 @@ var
{ has to be returned via MirandaPluginInfo and has to be statically allocated,
this means only one module can return info, you shouldn't be merging them anyway! }
PluginInfo: TPLUGININFOEX;
+ g_plugin: CMPlugin;
{$include m_clist.inc}
{$include m_genmenu.inc}
@@ -243,4 +254,12 @@ implementation
{$undef M_API_UNIT}
{$include m_helpers.inc}
+initialization
+ g_plugin.m_hInst := hInstance;
+ RegisterPlugin(g_plugin);
+ hLangpack := g_plugin.m_hLang;
+
+finalization
+ UnregisterPlugin(g_plugin);
+
end.
diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc
index 9810ff69a4..bea8231de3 100644
--- a/include/delphi/m_helpers.inc
+++ b/include/delphi/m_helpers.inc
@@ -254,9 +254,8 @@ end;
function Langpack_Register:int_ptr;
begin
- mir_getLP(PluginInfo, hLangpack);
cli := Clist_GetInterface();
- result:=hLangpack;
+ result := hLangpack;
end;
diff --git a/include/delphi/m_langpack.inc b/include/delphi/m_langpack.inc
index 3091b574b3..597c0cf1db 100644
--- a/include/delphi/m_langpack.inc
+++ b/include/delphi/m_langpack.inc
@@ -35,7 +35,7 @@ const
ME_LANGPACK_CHANGE:PAnsiChar = 'LangPack/Changed';
-procedure mir_getLP(var pInfo:TPLUGININFOEX; var hLang:int); stdcall;
- external CoreDLL name 'mir_getLP';
+procedure RegisterPlugin(var pInfo:CMPlugin); stdcall; external AppDLL;
+procedure UnregisterPlugin(var pInfo:CMPlugin); stdcall; external AppDLL;
{$ENDIF}