Fórum Dll´s #186534
06/10/2003
0
tenho uma dll com varias funções,
como faço para assossiar a dll com o meu programa, e tb,
como0 faço para usar as funções que estão dentro da DLL.
Se a DLL for feita em C tem algum problema de eu usar uma função dela no Delphi?
Smaug_84
Curtir tópico
+ 0Posts
06/10/2003
Beppe
function MinhaFuncao(Param1, Param2: Integer): Integer name ´NomeExportadoParaAFuncao´ external ´minhadll.dll´;
Você tb deve usar a msm cc. e. g. stdcall, cdecl, etc...
É importante adicionar ShareMem na uses do projeto, antes das outras, quando você usar strings, variants ou interfaces.
Se vc tiver uma dll escrita em outra linguagem, você precisa os tipos equivalentes em Delphi.
C++ | Delphi int Integer char Char bool Boolean char* PChar
Gostei + 0
07/10/2003
Smaug_84
tentei criar mais nem tava compilando
library Project2;
uses
SysUtils,
Classes;
{$R *.res}
function teste : PChar;
begin
Result := ´ola mundo´;
end;
begin
end.
Gostei + 0
07/10/2003
Eric.miranda
library Project2;
uses
SysUtils,
Classes;
{$R *.res}
function teste : PChar;export;stdcall;
begin
Result := ´ola mundo´;
end;
exports
teste;
begin
end.
Gostei + 0
07/10/2003
Beppe
Gostei + 0
07/10/2003
Smaug_84
expected ´;´ but an identifier found
nao sei oq é?
minha DLL
-------------------------------------------------------------------------
library Project2;
uses
SysUtils,
Classes;
{$R *.res}
function teste : PChar;export;stdcall;
begin
Result := ´ola mundo´;
end;
exports
teste;
begin
end.
meu programa
---------------------------------------------------------------------
unit Unit1;
interface
uses
ShareMem, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls ;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
function t : Pchar name ´teste´ external ´project1.dll´;// name ´teste´;
//function OpenFile: Integer; cdecl; external ´libc.so.6´ name ´open´;
//function printf(Format: PChar): Intege0r; cdecl; varargs;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
t;
end;
end.
Gostei + 0
07/10/2003
Beppe
Gostei + 0
07/10/2003
Beppe
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)