现有一个dll,只有c#调用的示例程序,没有vc6调用的demo。如何在vc6里定义如下结构:c#源代码public struct PKI_DATA_S
{
public int size;
public IntPtr pvalue; public int getSize()
{
return size;
} public Byte[] getValue()
{
Byte[] byary = new Byte[size];
Marshal.Copy(pvalue, byary, 0, size); return byary; 
} public String getValueString()
{
if(size == 0)
{
return "";
}
else
{
Byte[] byary = new Byte[size];
Marshal.Copy(pvalue, byary, 0, size); String outStr = System.Text.Encoding.Default.GetString(byary);
return outStr;
}
}
}

解决方案 »

  1.   

    typedef struct PKI_DATA_S
    {
    public: 
    int size;
    IntPtr pvalue;

    int getSize()
    {
    return size;
    }
    public:
    Byte[] getValue()
    {
    Byte[] byary = new Byte[size];
    Marshal.Copy(pvalue, byary, 0, size);

    return byary; 
    }

    String getValueString()
    {
    if(size == 0)
    {
    return "";
    }
    else
    {
    Byte[] byary = new Byte[size];
    Marshal.Copy(pvalue, byary, 0, size);

    String outStr = System.Text.Encoding.Default.GetString(byary);
    return outStr;
    }
    }
    }PKI_DATA_S==============
    C#我也不会~有的地方知道怎么改~