返回列表 发帖
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);
}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

TOP

回复 14# 小白龙


    我用的vs2019。小白一个,对原理,报错啥的我都不怎么会,只是点一下按钮生成一下。
我用的dll
https://t.wss.ink/f/aq9mrsmo32b 复制链接到浏览器打开

TOP

回复 33# 小白龙


    64位的,我这边正常。其他的不清楚

TOP

返回列表