Unable to Create 64 bit DLL in Windows lazarus / 34-Windows ---------------------------------------------------------------------- williamda · 2011-07-28 22:02 Hello, I´m new to Lazarus. I´m moving from Delphi looking for a 64 bit compiler. I really believe Embarcadero has lost the directions with DElphi developing and Lazarus/FPC looks more promising. My first project is to create a 64 bit DLL in Lazarus and call it from another Lazarus application. But I get a SISEGV error whenever I try to call it with early or late binding. I´ve found that the debugger still doesn´t work in 64 bit Windows. Creating/calling a 64 bit DLL can be done with Lazarus. I tried with oficcial release 0.93 and Lazarus trunk, but none of these worked. --- This is the exported function function Hola: Int64; stdcall; export; begin   Result := 22; end;  ---- This is the call // Early Binding function Hola: Int64; external 'testhola.dll'; procedure TForm1.Button4Click(Sender: TObject); var   Res : Int64; begin   Res := Hola();   lbLoadStatus.caption := 'Hola Retorna :' + IntToStr(res); end;  // Late Binding procedure TForm1.Button3Click(Sender: TObject); type   THola = function(): Int64; stdcall; var   Hola: THola;   res: Int64; begin   FDLLHandle := LoadLibrary( PChar(S) );   if FDLLHandle < HINSTANCE_ERROR then     lbLoadStatus.Caption := SystemErrorMessage + ' (Error ' + IntToStr(GetLastError) + ')'   else     lbLoadStatus.Caption := 'DLL cargada exitosamente';   Hola := THola(GetProcAddress(FDLLHandle, 'Hola'));   {if procedure is found in the dll}   if not Assigned(@Hola) then   begin     lbLoadStatus.caption := SystemErrorMessage + ' (Error ' + IntToStr(GetLastError) + ')'   end   else   begin     Res := Hola();     lbLoadStatus.caption := 'Hola Retorna :' + IntToStr(res);   end; end; Thanks for your answers, ---------------------------------------------------------------------- felipemdc · 2011-07-30 20:20 Have you tryed using FPC Trunk? Which FPC versions have you tried? Changing Lazarus itself shouldn't change anything here, the important is the version of FPC. ---------------------------------------------------------------------- Leledumbo · 2011-07-31 07:12 Code: [Select]--- This is the exported function function Hola: Int64; stdcall; export; ... ---- This is the call // Early Binding function Hola: Int64; external 'testhola.dll'; You miss stdcall in the external declaration. ---------------------------------------------------------------------- williamda · 2011-08-02 21:56 You´re right, I missed to put stdcall at the external definition. I fixed it, but still get the same error  (0xc000007b) when launching the application. I also downloaded the fpc trunk, but I don´t now how to make it work with Lazarus. I´ll appreciate some advice or a link to learn how . Thanks for your replies, ---------------------------------------------------------------------- Martin_fr · 2011-08-02 22:38 1) Debugging: If you use FPC trunk; and Lazarus trunk, then it should work. But make sure your anti-virus does not interfere. 2) On 32 bit (but may happen on 64 bit too, don't know), I had once problems with dll. Turned out that bitdefender (Antivirus) just deleted the dll file => without warning, and despite all settings, saying to *always* ask first. Maybe ? ---------------------------------------------------------------------- Marc · 2011-08-03 07:21 1) How did you declare FDLLHandle ? some handle types are still defined 32 bit on a 64bit windows. 2) (iirc) check for Assigned(Hola) instead of Assigned(@Hola)