Respostas no Fórum

Visualizando 1 post (de 1 do total)
  • Autor
    Posts
  • em resposta a: Como declarar a SAT.DLL em vb.net ? #533

    alexandrem
    Participante

    Fala Rodrigo! Parceiro, o problema do PInvoke mencionado pelo “ferdead” persiste, mesmo usando suas declarações, montei uma simples POC console APP c# e o erro descrito pelo usuário acima, persiste. Alguma ajuda? Versão da DLL 2.0.0.0

    class Program
    {
    static void Main(string[] args)
    {

    var sat = new Tanca();
    var res = sat.ConsultarSAT(new Random().Next(9999));
    Console.WriteLine(res);
    Console.Read();
    }
    }

    public class Tanca
    {

    public string ConsultarSAT(int sessao)
    {
    return Declaracao_Func_SAT.ConsultarSAT(sessao);
    }

    class Declaracao_Func_SAT
    {
    const string strSATDLL = “SAT.DLL”;

    [DllImport(strSATDLL, CallingConvention = CallingConvention.Cdecl)]
    public static extern string ConsultarSAT(int numeroSessao);
    }

    }

    Erro:
    Managed Debugging Assistant ‘PInvokeStackImbalance’ : ‘A call to PInvoke function ‘SatTanc!SatTanc.Tanca+Declaracao_Func_SAT::ConsultarSAT’ has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.’

Visualizando 1 post (de 1 do total)