Problema de memória e DLL !!

Delphi

12/12/2003

Bom dia.
Tenho uma unit onde declaro funções de algumas ddl.


unit funcao;

interface

uses SysUtils;
   function StrToPChar(const Str: string): PChar;

   function MessageBox(HWnd: Integer; Text, Caption: PChar;
Flags: Integer): Integer; stdcall;external ´user32.dll´ name ´MessageBoxA´;

{------------------}
   DARUMA345
{------------------}

function DAR_Status: Integer;
function DAR_Status; external ´fs345_32.dll´;
function DAR_AbreSerial(conf:string): Integer;stdcall;external ´fs345_32.dll´;

....

{---------------------------}
   IMPRESSORA DUAL
{---------------------------}

function Abre_Cupom(Porta: String; Controle : String):Integer;stdcall;external ´turbo.dll´;
function Vende_Item(codigo:String; nome:String; quant:String; unitario : String; total : String; Porta : String):Integer; stdcall;external ´turbo.dll´;
function Exclui_Item(Porta:String; nome: String):Integer; stdcall;external ´turbo.dll´;
function Contravale(numero:Integer; Nome:String; Valor : String; Porta : String):Integer; stdcall;external ´turbo.dll´;
// fundo de caixa ou suprimento
function Fundo_Caixa(numero : Integer; Nome : String; Valor : String; Porta : String):Integer; stdcall;external ´turbo.dll´;
// avança linhas
function Avanca(quant:Integer; Porta : String):Integer; stdcall;external ´turbo.dll´;
// abre gaveta
function A_Gaveta(Porta : String):Integer;stdcall;export;external ´turbo.dll´;
// permite a inserção de um texto qualquer
function Linha_Aberta(Texto:String; Porta : String):Integer;stdcall;external ´turbo.dll´;
//cancela o cupom atual
function Canc_Venda(Numero:String; Porta : String):Integer; stdcall;external ´turbo.dll´;
function Vinculado(Cupom : String; Vl_Total : String; Vl_Pago : String; Porta : String):Integer; stdcall;external ´turbo.dll´;

...

{---------------------------}
       URANO 1EFC3
{---------------------------}

function InicializaDLL(Porta: String): Integer; stdcall; external ´Dll1efc3.dll´;
function FinalizaDLL: Integer; stdcall; external ´Dll1efc3.dll´;
function Relatorio_XZ(Tipo: String): Integer; stdcall; external ´Dll1efc3.dll´;
function FinalizaRelatorio(operador: string): Integer; stdcall; external ´Dll1efc3.dll´;
function ImprimeCabecalho: Integer; stdcall; external ´Dll1efc3.dll´;
function LinhasLivres(texto: string): Integer; stdcall; external ´Dll1efc3.dll´;
function VendaItem(Cod, Descr, Qtde, VUnit, Ident, Unid, Tipo: String): Integer; stdcall; external ´Dll1efc3.dll´;
function Pagamento(Cod, Descr, Valor, Acumular: String): Integer; stdcall; 

{---------------------------}
     DISPLAY GERTEC
{---------------------------}

 Procedure OpenTec44; stdcall; export; external ´Tec44Win.dll´
 Procedure CloseTec44; stdcall; export; external ´Tec44Win.dll´

...
 



E porai vai ... ou seja meu sistema roda com varias impressoras fiscais e tenho declarada todas funções de todas as dll. Porém possuo um arquivo ini configurado qual impressora meu sistema vai utilizar e gostaria que ele apenas carregasse as funções da dll dessa impressora e não todas funções de todas dll pq acho que isso esta pesando um pouco no meu sistema, alguns momento ocorre um estouro de memória =(

Valeuuuu =)


Fer

Fer

Curtidas 0

Respostas

Marcelo Saviski

Marcelo Saviski

12/12/2003

p/ carregar a dll só quando vc quiser, acho que faz + ou - asim:

var
  Library: THandle;

funtion AlgumaCoisa(Params: TipoTal): TipoTal;






....

para carregar:

begin
  Library := LoadLibrary(´DllTal.dll´);
  @AlgumaCoisa := GetProcAddress(Library, ´Nome da Função´);
 
end;




para Descarregar:

FreeLibrary(Library);



GOSTEI 0
POSTAR