编写 C DLL 的替代品?
我想为 w3btrv7.dll 编写一个非常简单的替代品,这样我就可以将 Btrieve API 调用传递给另一个库(用 .NET 编写并通过 COM 调用)。 基本上,我需要模仿 C 中 BTRCALL 函数的签名。但是,我根本不是 C 程序员......。 我认为我非常清楚如何编写导出函数的 DLL,但除此之外,我还迷失了方向。
基本签名如下所示:
int BTRCALL(Operation Code, Position Block, Data Buffer, Data Buffer Length,
Key Buffer, Key Buffer Length, Key Number)
操作代码 - 整数
位置块 - 128字节数组
数据缓冲区 - 我找不到关于此的很多详细信息,但我假设它是一个字节数组,其长度由数据缓冲区长度参数指定。
数据缓冲区长度 - 同样,信息不多,但我假设这是一个整数,指定前一个字节数组的长度。
Key Buffer - 最大大小为 255 字节的字节数组
Key Buffer Length - 前一个字节数组的长度
Key Number - 2- ?
任何人都可以建议一个与此签名匹配的 C 函数吗
I'd like to write a very simple replacement for w3btrv7.dll so I can pass Btrieve API calls to another library (written in .NET and called via COM). Basically, I need to mimic the signature of the BTRCALL function in C. However, I'm not a C programmer... at all. I think I have a pretty good idea of how to write a DLL that exports functions, but beyond that, I'm lost.
The basic signature looks like this:
int BTRCALL(Operation Code, Position Block, Data Buffer, Data Buffer Length,
Key Buffer, Key Buffer Length, Key Number)
Operation Code - integer
Position Block - 128 byte array
Data Buffer - I can't find many details about this, but I assume it's a byte array whose length is specified by the Data Buffer Length parameter.
Data Buffer Length - Again, not much information, but I assume this is an integer that specifies the length of the previous byte array.
Key Buffer - A byte array with a maximum size of 255 bytes
Key Buffer Length - The length of the previous byte array
Key Number - 2-byte integer
Can anyone suggest a function in C that matches this signature?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要 types.h 包含来获取指定 2 字节(有符号)整数的 int16_t 类型。
请注意,数组没有指定大小,这就是为什么大小必须位于单独的参数中或先验已知(与 pos_block 一样)。
You need the types.h include to get the int16_t type that specifies an exactly 2-byte (signed) integer.
Note how the arrays don't have a size specified, that's why the sizes have to be in a separate parameter or known a priori (as with pos_block).