| extern "C" _declspec(dllexport)void h2p(const char* szChinese) | | { | | uint32_t bufLen = 0; | | char pinyinBuf[MAXBUFLEN] = { 0 }; | | | | getPinyin(szChinese, pinyinBuf, MAXBUFLEN, &bufLen, enmPinyinMode_FirstUpper); | | printf("%s\n", pinyinBuf); | | }COPY |
| $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("我是中国人")COPY |
|