如何调用C++中的如下函数啊!
void convertDomainName(char * strName)
如何转换成C#中的函数啊 
[DllImport("Test.dll")]
public static extern convertDomainName(string strName);
这样好像不成功啊!怎么办啊!

解决方案 »

  1.   

    不是一样的东西,,当然不行了...得用动态链接库,,,不能是COM
      

  2.   

    把char * 换成 [MarshalAs( UnmanageType.LPTStr )]string
      

  3.   

    试试这个
    [DllImport("Test.dll")]
    public static extern convertDomainName(string ref strName);
      

  4.   

    [MarshalAs( UnmanageType.LPTStr )]string
    不行啊
      

  5.   

    参照:
    [DllImport("user32.dll",EntryPoint="MessageBox",CharSet=CharSet.Auto)]
    public static extern int Msg(
    System.IntPtr hwnd,
    [MarshalAs(UnmanagedType.LPTStr)]
    ref string text,
    [MarshalAs(UnmanagedType.LPTStr)]
    string caption,
    int utype
    );