Ver Mensaje Individual
  #1  
Antiguo 26-01-2020
webmasterplc webmasterplc is offline
Miembro
 
Registrado: mar 2008
Posts: 275
Reputación: 17
webmasterplc Va por buen camino
Funciones y Procedimientos en DLL

Buenas hasta ahora me ha ido muy bien con delphi agradecido d este foro he ido aprendiendo mucho hoy me acarrea na duda me gustaría pasar las funciones y los procedimientos de una aplicación a dll y luego llamarlos desde el código.

esta es una función que uso y con este tipo de funciones no tengo problemas

Código Delphi [-]
function ceros_izq(strValue: String; intNewWidth: Integer): String; stdcall;
var intOldWidth, I: Integer;
begin
  try
    strValue := Trim (StrValue);
    if strValue = '' then
      strValue := '0';
    if StrToInt(strValue) < 0 then
      strValue := '0';
  except
    on EConvertError do strValue := '0';
  end;
  intOldWidth := Length(strValue);
  if intOldWidth < intNewWidth then
    for I := 1 to intNewWidth - intOldWidth do
      strValue := '0' + strValue;
  Result := strValue;
end;

el problema o la tranca se me presento en las funciones o procedimientos que tienen acceso a datos como esta
Código Delphi [-]
procedure actualizar (ncomprobante:Integer);stdcall;
var
pncomprobante:Integer;
begin
    pncomprobante:=ncomprobante+1;
    with datos.sqactualizar do
    begin
    Close;
    SQL.Clear;
    SQL.Add('UPDATE configuracion set conf_comprobante=ncomprobante');
    ParamByName('pncomprobante').AsInteger:=pncomprobante;
    ExecSQL;
    end;
end;
uso mydac y en otros proyectos zeoslib y tendria que crear los componentes en tiempo de ejecución y no se si a cada dll tendria que crear una conexion y pasarle los parametros, hasta donde seria recomendado hacerlo asi o si usare recursos indebidamente
Responder Con Cita