load dll lazarus / 9-Editor ---------------------------------------------------------------------- skaner1900 · 2010-10-23 18:46 procedure TForm1.Button1Click(Sender: TObject); var   DLL : THandle;   ShowForm : procedure; begin   DLL := LoadLibrary('LibSample.dll');   try     ShowForm := GetProcAddress(DLL, 'ShowForm');       <-------LINE 60     if ShowForm=nil then raise Exception.Create('Bład');     ShowForm;   finally     FreeLibrary(DLL);   end; end; unit1.pas(60,17) Error: Incompatible types: got "Pointer" expected "" i'm stupid or my lazarus is broken? ;( ---------------------------------------------------------------------- Phil · 2010-10-23 19:11 Since GetProcAddress returns a pointer, ShowForm should be declared Pointer. Then to call ShowForm, you normally cast it to a function type that matches (1) the library function's parameter signature and (2) the function's calling convention. See various FPC source packages for how this is done. For example, I see the MySql package does this extensively. Also, make sure Windows can find your DLL, per normal Windows library loading assumptions. See Windows documentation for LoadLibrary. If in doubt include path to DLL. Thanks. -Phil ---------------------------------------------------------------------- cdbc · 2010-10-24 04:52 Hi In lieu of Phils comment, it would look something like this: procedure TForm1.Button1Click(Sender: TObject); var   DLL : THandle;   ShowForm : procedure(Sender: TObject); register; // presumably begin   DLL := LoadLibrary('LibSample.dll');   try     pointer(ShowForm) := GetProcAddress(DLL, 'ShowForm');       <-------LINE 60     if ShowForm=nil then raise Exception.Create('Bład');     ShowForm(Sender);   finally     FreeLibrary(DLL);   end; end; Beware untested code, just some hints... hth - Regards Benny