demo下载地址:https://download.youkuaiyun.com/download/2403_83063732/88958730
1、创建IDL文件以及acf文件(创建helloworld.idl helloworld.acf)
其中IDL文件:
import "oaidl.idl";
import "ocidl.idl";
[
uuid("4556509F-618A-46CF-AB3D-ED736ED66477"), // 唯一的UUID,主要是用来通讯的时候使用
version(1.0)
]interface HelloWorld
{
// 官方文档推荐的自定义字符串写法(带长度和大小)
typedef struct _MYSTRING
{
unsigned short size;
unsigned short length;
[ptr,size_is(size), length_is(length)] char string[*];
} MYSTRING;
typedef [ptr] MYSTRING** PPMYSTRING;
typedef [ptr] MYSTRING* PMYSTRING;// 我们定义的方法,只列举这几个应该够我们用了
void Hello([in, string]const char * psz);//只输入,不带返回值
int Add([in]int a1,[in]int a2);//带返回值
int GetTestString([out]PMYSTRING *pName);//可以获取对端的数据,比如状态或者其他
}
ACF文件如下内容
[
implicit_handle (handle_t HelloWorld_IfHandle)
]
interface HelloWorld
{
}
2、调用midl指令,生成.c/.h文件
midl helloworld.idl /acf helloworld.acf /out ./

最低0.47元/天 解锁文章
3666

被折叠的 条评论
为什么被折叠?



