![]() |
Problem mit LoadLibrary
Hallo,
ich verzweifle gerade, einen simplen Code von Delphi7 nach Lazarus/fpc zu portieren, der eine dll dynamisch laden soll. LoadLibrary funktioniert nicht, liefert 0 zurück. Hier mein Code:
Delphi-Quellcode:
Derselbe Code in Delphi7 funktioniert einwandfrei. Der Pfad zur dll stimmt.
unit Unit1;
{$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Windows; type { TForm1 } TForm1 = class(TForm) Button1: TButton; Label1: TLabel; procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } var dll_handle: Cardinal=0; procedure TForm1.Button1Click(Sender: TObject); begin dll_handle := LoadLibrary('d:\test\TestLib.dll'); Label1.Caption:=inttostr(dll_handle); end; end. Was mache ich falsch? Kann das was damit zu tun haben, dass Delpi7 32bit code produziert, womit auch die dll erzeugt wurde, Lazarus aber 64bit code macht? Kann ich auf einer 64bit Maschine mit Lazarus auch 32bit Code erzeugen? |
AW: Problem mit LoadLibrary
Hallo
,ein 64Bit-Programm kann keine 32bit-DLL laden. Lazarus kann ich 32bit erzeugen. |
AW: Problem mit LoadLibrary
Grundsätzlich ist es immer eine gute Idee,
![]() ![]() Wie hoika schon sagte: Ein 32-bit Programm kann keine 64-bit DLLs laden und umgekehrt. Und selbst wenn beide 32-bit oder beide 64-bit sind, spielt noch die Architektur eine Rolle (x86, ARM usw). Grüße Dalai |
AW: Problem mit LoadLibrary
Zitat:
Sogar Delphi kann in einem 32 Bit-Windows eine 64 Bit-EXE und sogar Android-Apps oder für Linux kompilieren. :stupid: Und wie Dalai schon richtig sagte, eine Fehlerbehandlung kann nie schaden. Es steht sogar in der Hilfe drin, was man hier machen muß. ![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:54 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz