- extern "C" _declspec(dllexport)void h2p(const char* szChinese)
- {
- uint32_t bufLen = 0;
- char pinyinBuf[MAXBUFLEN] = { 0 };
- //const char* szChinese = "中华人民共和国 People's Republic of China";
- getPinyin(szChinese, pinyinBuf, MAXBUFLEN, &bufLen, enmPinyinMode_FirstUpper);
- printf("%s\n", pinyinBuf);
- }
复制代码
- $code=@"
- using System;
- using System.Runtime.InteropServices;
- public static class Api{
- [DllImport("C:/Users/Administrator/source/repos/test/x64/Release/test.dll")]
- public static extern int h2p(String ss);
- }
- "@
- Add-Type -TypeDefinition $code
- [Api]::h2p("我是中国人")
复制代码
|