Ara you OK?
我看你是思想出现了偏差
哇!你认出了错别单词!恭喜你获得一次向我支付宝充值助我重返欧洲的机会!
这个页面管关不掉了,你自己看着办吧

C/C++和C#混合编程笔记-DLL调用与IPC等mixed问题记录

个人备查笔记,视情况补全

---------------------------------------------------------------

 

Q.C#调用C++ DLL:

C++部分

extern "C" {
    __declspec(dllexport) IS_RET ImageQuilting( TMatrix *Src, TMatrix *Dest,
                                               int TileSizeX, int TileSizeY, 
                                               int OverlapX, int OverlapY );

    __declspec(dllexport) BSTR  ImageQuiltingEx(BSTR* inputpath, BSTR* outputpath,
                                                int TileSizeX, int TileSizeY,
                                                int OverlapX, int OverlapY);
}

 

 

C#部分

        [DllImport("ImageProcessing.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true)]
        private static extern IS_RET ImageQuilting(ref TMatrix Src, ref TMatrix Dest, int TileSizeX, int TileSizeY, int OverlapX, int OverlapY);

        [DllImport("ImageProcessing.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true)]
        static extern unsafe string ImageQuiltingEx(ref string intputpath, ref string outputpath, int TileSizeX = -1, int TileSizeY = -1, int OverlapX = -1, int OverlapY = -1);

 

 

Q.C++/C#传递中文字符串的几种方式:

1.C#: StringBuilder

2.C#: [MarshalAs(UnmanagedType.LPStr)]string

3.C++: 使用BSTR

连接一:https://stackoverflow.com/questions/1450731/equivalent-char-in-c-sharp

 

posted @ 2019-10-15 17:52  林清  阅读(532)  评论(0编辑  收藏  举报