![]() |
DLLs
Hi,
ich will mich gerade auf das Thema DLL stürzen, doch es will nicht so wie ich will. Darum frage ich euch, hat jemand ein Programm wo eine DLL eingebunden wird. Man saoll nur eine showmessage ausgeben, doch die function/procedure steht in der DLL. Falls ihr soetwas habt wäre ich echt dankbar wenn ihr das hochladen könntet. Ich hab mir schon das Tutorial von Assarbad durchgelesen, doch ich versteh nur Bahnhof !!! ByStones |
Re: DLLs
Schau dir mal das Tutorial bei
![]() |
Re: DLLs
Zitat:
Delphi-Quellcode:
Mein Code:
[Error] Unit1.pas(13): E2065 Unsatisfied forward or external declaration: 'TForm1.addiere'
[Fatal Error] mathe.dpr(5): F2063 Could not compile used unit 'Unit1.pas'
Delphi-Quellcode:
Mein DLL:
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; function addiere(zahl1, zahl2: integer): integer; stdcall; private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function addiere(zahl1, zahl2: integer): integer; stdcall; external 'rechnen.dll'; end.
Delphi-Quellcode:
ich hab keine Ahnung wo der Fehler liegt !!!
library rechnen;
{ 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. } uses SysUtils, Classes; {$R *.res} function addiere(zahl1, zahl2: integer): integer; stdcall; begin result := zahl1+zahl2; end; exports addiere; begin end. |
Re: DLLs
Oder hier:
![]() |
Re: DLLs
nimm mal die Funktion aus dem "TForm1" - Abschnitt heraus und setze das hier:
Delphi-Quellcode:
vor den implementation - Abschnitt. Geht's dann?
function addiere(zahl1, zahl2: integer): integer; stdcall;
external 'rechnen.dll'; |
Re: DLLs
Zitat:
Jetzt geht's !!! Es geht !!!! :dancer: :dancer: :dancer: :dancer2: :dancer2: :party: :party: :party: :hi: :hi: :cheers: :cheers: Danke Daniel G !!!!!!!!!!!! :thumb: :thumb: :thumb: |
Re: DLLs
Zitat:
|
Re: DLLs
Es wäre schon wenn ihr mir noch sagen könntet wie man das
ganze mit einer procedure macht !!! Danke schon mal wieder im vorraus !!! |
Re: DLLs
Zitat:
Insofern stellt sich (zumindest mir) die Frage: was willst du genau machen? |
Re: DLLs
Zitat:
Delphi-Quellcode:
procedure show; stdcall;
begin showmessage('hi'); end;
Delphi-Quellcode:
da pssiert einfach nichts, keine Fehlermeldung, nichts
procedure show; stdcall;
external 'rechnen.dll'; procedure TForm1.Button1Click(Sender: TObject); begin show; Form1.Caption := inttostr(addiere(5,5)); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:00 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