0

我有一个静态库(.lib 文件)

我想在我的程序中静态链接和使用。但是我没有源代码,所以我需要自己编写头文件。

这是我的笨蛋 /exports 的结果

文件类型:图书馆

Exports

 ordinal    name

      ?about@@YGHXZ (int __stdcall about(void))
      ?barcode@@YGHPAD00000000@Z (int __stdcall barcode(char *,char *,char *,char *,char *,char *,char *,char *,char *))
      ?clearbuffer@@YGHXZ (int __stdcall clearbuffer(void))
      ?closeport@@YGHXZ (int __stdcall closeport(void))
      ?downloadpcx@@YGHPAD0@Z (int __stdcall downloadpcx(char *,char *))
      ?formfeed@@YGHXZ (int __stdcall formfeed(void))
      ?nobackfeed@@YGHXZ (int __stdcall nobackfeed(void))
      ?openport@@YGHPAD@Z (int __stdcall openport(char *))
      ?printerfont@@YGHPAD000000@Z (int __stdcall printerfont(char *,char *,char *,char *,char *,char *,char *))
      ?printlabel@@YGHPAD0@Z (int __stdcall printlabel(char *,char *))
      ?sendcommand@@YGHPAD@Z (int __stdcall sendcommand(char *))
      ?setup@@YGHPAD000000@Z (int __stdcall setup(char *,char *,char *,char *,char *,char *,char *))
      ?usbportqueryprinter@@YGHXZ (int __stdcall usbportqueryprinter(void))
      ?usbportwrite@@YGHPAD@Z (int __stdcall usbportwrite(char *))
      ?windowsfont@@YGHHHHHHHPAD0@Z (int __stdcall windowsfont(int,int,int,int,int,int,char *,char *))
      ?windowsfontU@@YGHHHHHHHPAD0@Z (int __stdcall windowsfontU(int,int,int,int,int,int,char *,char *))

我试图编写一个头文件,以便可以使用这些函数(显示一个):

int __stdcall openport(char *printername);

我已将库静态链接到我的程序,并尝试调用该函数openport,但我得到一个undefined reference to openport(char*)@4.

有谁知道如何写这个,所以这将正确链接?(或者这甚至是个好主意?)

编辑

我也跑了undname ?openport@@YGHPAD@Z,它返回:

取消装饰 :- "?openport@@YGHPAD@Z"

是:-“int __stdcall openport(char *)”

这可能意味着我无法正确链接。

4

0 回答 0