编写 C DLL 的替代品?

发布于 2024-08-01 12:56:52 字数 765 浏览 5 评论 0原文

我想为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌若浮生 2024-08-08 12:56:52
#include <types.h>
int BTRCALL(int op_code, char pos_block[], char data_buf[], int data_buf_len, char key_buf[], int key_buf_len, int16_t key_num)

您需要 types.h 包含来获取指定 2 字节(有符号)整数的 int16_t 类型。

请注意,数组没有指定大小,这就是为什么大小必须位于单独的参数中或先验已知(与 pos_block 一样)。

#include <types.h>
int BTRCALL(int op_code, char pos_block[], char data_buf[], int data_buf_len, char key_buf[], int key_buf_len, int16_t key_num)

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文