0
I’m studying the use of DLL, I created one by sending two integer variables, specifically 3 and 10536. Debugging the DLL verifies that in the process I am calling and that receives these two variables, they are with completely different values than the ones I sent.
Calling for Explicitly
idMestre := 3;
idFunc   := 10536;
if (qryMvFol_M.RecordCount > 0) then
begin
   Handle := LoadLibrary('Calc_Encargos.DLL');
   if (Handle = 0) then
   begin
      Informando('Calc_Encargos.DLL não encontrada.');
      Exit;
   end
   else
   begin
     mPrepara_Para_Calcular := GetProcAddress(Handle, 'Prepara_Para_Calcular');
     mPrepara_Para_Calcular(idMestre, idFunc);
     FreeLibrary(Handle);
   end;
end;
Procedure DLL
procedure Prepara_Para_Calcular(idMestre, idFunc:Integer); stdcall;
begin
{  Aqui chega idMestre = 1524722
              idFunc   = 54771
Não estou entendendo  
}
  try
     Ler_Conecao_Banco;
     qryWork := TFDQuery.Create(nil);
     strSQL := ' select MF.ID_PD, MF.TOTAL'+
               '   from FOLHA_MOV_F MF'+
               '  where MF.ID_REG_MESTRE  = '+FmtInt(idMestre)+
               '    and MF.ID_FUNCIONARIO = '+FmtInt(idFunc)+
               '  union all'+
               ' select MV.ID_PD, MV.TOTAL'+
               '   from FOLHA_MOV_V MV'+
               '  where MV.ID_REG_MESTRE  = '+FmtInt(idMestre)+
               '    and MV.ID_FUNCIONARIO = '+FmtInt(idFunc);
     Prepara_wQuery(qryWork, 'RH', strSQL, '');
     if (qryWork.RecordCount > 0) then
        Erro(IntToStr(qryWork.RecordCount))
     else
        Erro('Sem registro neste filtro');
  finally
     qryWork.Destroy;
  end;
end;
What could be causing this?