Como declarar uma DLL numa Unit em Delphi 3 ?

Delphi

28/03/2003

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.


Amjorge

Amjorge

Curtidas 0

Respostas

E_gama

E_gama

28/03/2003

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. }



GOSTEI 0
POSTAR