Source

Notepad++PluginLazarus / ANSI / helloworld.lpr

Full commit
library helloworld;

{$ifdef fpc}
{$MODE Delphi}
{$endif}

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }

{$R 'helloworldres.res' 'helloworldres.rc'}

uses
  SysUtils,
  Classes,
  Types,
  {$ifdef fpc}
  // These allow the LCL windowclass to be registered
  Interfaces, LCLIntf, LCLType, LMessages,forms,
  {$else}
  Windows,
  {$endif fpc}
  Messages,
  nppplugin in 'lib\nppplugin.pas',
  scisupport in 'lib\SciSupport.pas',
  NppForms in 'lib\NppForms.pas' {NppForm},
  NppDockingForms in 'lib\NppDockingForms.pas' {NppDockingForm},
  helloworldplugin in 'helloworldplugin.pas',
  AboutForms in 'AboutForms.pas' {AboutForm},
  helloworlddockingforms in 'helloworlddockingforms.pas' {HelloWorldDockingForm}
  {$ifdef fpc}
  ,
  Windows
  {$endif fpc}
  ;

{$ifdef fpc}
{$Include 'lib\NppPluginInclude.pas'}
{$else}
// original code though I doubt that's correct - there is no paslib directory??!?
{$Include '.paslib\NppPluginInclude.pas'}
{$endif}

begin
  {$ifdef fpc}
  Dll_Process_Detach_Hook := @DLLEntryPoint;
  // Leaving these two in causes a crash for some reason:
  //Dll_Thread_Attach_Hook:= @DLLEntryPoint;
  //Dll_Thread_Detach_Hook:= @DLLEntryPoint;
  {$else}
  // Delphi
  { First, assign the procedure to the DLLProc variable }
  DllProc := @DLLEntryPoint;
  {$endif fpc}
  { Now invoke the procedure to reflect that the DLL is attaching to the process }
  DLLEntryPoint(DLL_PROCESS_ATTACH);
end.