Fórum Como declarar uma DLL numa Unit em Delphi 3 ? #150302
28/03/2003
0
Tenho uma DLL chamada Apoio.dll, com uma função SQLData(Data:String):String;
Como declará-la numa Unit nos Delphi 3 ? Precxisa declara na interface ou só na implementation ?
Obrigado.
Como declará-la numa Unit nos Delphi 3 ? Precxisa declara na interface ou só na implementation ?
Obrigado.
Amjorge
Curtir tópico
+ 0
Responder
Posts
28/03/2003
E_gama
Implementation function SQLData(Data:String):String; external ´apollo.dll´;
O Ideal para trabalhar com DLL é evitar os parametros tipo [b:0a57fa58a9]string[/b:0a57fa58a9]. Ao invés disso, deve-se utilizar o tipo [b:0a57fa58a9]PChar[/b:0a57fa58a9].
Quando se cria um DLL com o Delphi, no código fonte do projeto tem umas informações sobre isso:
{ 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. }
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)