corick 2022-09-27 10:06 采纳率: 75%
浏览 109
已结题

C++ Builder 怎么调用 inpout32.dll?

C++ Builder 怎么调用 inpout32.dll? 我用implib 生成了对应的lib文件,也用add proj 把lib文件导入工程中,其中的头文件inpout32.h是下载inpout32包里带有的,也#include 了,但是运行时却出现 [Linker Error] Unresolved external '__stdcall IsXP64Bit()' referenced from D:\BCBPROJ\DLLTEST\UNIT1.OBJ
这样的错误,哪位能指点一二,谢谢

程序主体C++ Builder 6
```c++
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "inpout32.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Button1Click(TObject *Sender)
{
     IsXP64Bit();
}
//



```c++
头文件C++ Builder 6
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
        TButton *Button1;
        void __fastcall Button1Click(TObject *Sender);
private:    // User declarations
public:        // User declarations
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

软件自带的头文件inpout32.h,应该是vc++的


```c++
#pragma once

//Functions exported from DLL.
//For easy inclusion is user projects.
//Original InpOut32 function support
void    _stdcall Out32(short PortAddress, short data);
short    _stdcall Inp32(short PortAddress);

//My extra functions for making life easy
BOOL    _stdcall IsInpOutDriverOpen();  //Returns TRUE if the InpOut driver was opened successfully
BOOL    _stdcall IsXP64Bit();            //Returns TRUE if the OS is 64bit (x64) Windows.

//DLLPortIO function support
UCHAR   _stdcall DlPortReadPortUchar (USHORT port);
void    _stdcall DlPortWritePortUchar(USHORT port, UCHAR Value);

USHORT  _stdcall DlPortReadPortUshort (USHORT port);
void    _stdcall DlPortWritePortUshort(USHORT port, USHORT Value);

ULONG    _stdcall DlPortReadPortUlong(ULONG port);
void    _stdcall DlPortWritePortUlong(ULONG port, ULONG Value);

//WinIO function support (Untested and probably does NOT work - esp. on x64!)
PBYTE    _stdcall MapPhysToLin(PBYTE pbPhysAddr, DWORD dwPhysSize, HANDLE *pPhysicalMemoryHandle);
BOOL    _stdcall UnmapPhysicalMemory(HANDLE PhysicalMemoryHandle, PBYTE pbLinAddr);
BOOL    _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal);
BOOL    _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal);








  • 写回答

4条回答 默认 最新

  • 来灵 2022-09-27 11:04
    关注

    1,附加依赖库添加文件名:inpout32.lib
    2,将工程设置成WIN32模式,别用x64,因为你引用的inpout32.dll是32位库

    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 10月5日
  • 赞助了问题酬金20元 9月27日
  • 创建了问题 9月27日

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 MATLAB动图问题
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名