Delphi 项目在OSX上使用dylib时出错

8fsztsew  于 2023-04-05  发布在  其他
关注(0)|答案(1)|浏览(101)

我使用 Delphi ,我创建了一个应用程序,我使用这个库(C语言的库)启动它
我第一次启动它的时候,我有一个错误,libhid.dylib没有找到。我已经把它添加到rpath,错误得到解决。
但是现在,当我打开应用程序并尝试从库中调用方法时,我会得到下一个:

Process:               Project2 [8538]
Path:                  /Users/USER/*/Project2.app/Contents/MacOS/Project2  
Identifier:            Project2 
Version:               1.0.0 (1.0.0)
Code Type:             X86 (Native)
Parent Process:        ??? [1]
Responsible:           Project2 [8538]
User ID:               506

Date/Time:             2018-01-23 14:03:14.976 +0200
OS Version:            Mac OS X 10.12.6 (16G29)
Report Version:        12
Anonymous UUID:        4E81F6AB-1EEF-F9C1-160C-A01D8944D786

Sleep/Wake UUID:       DB3C055B-BE55-40B8-88A5-6D5530E284AB . 

Time Awake Since Boot: 140000 seconds
Time Since Wake:       14000 seconds


System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD, [0x4] Symbol missing

Dyld Error Message:
Symbol not found: _DeleteAll
Referenced from: /Users/USER/*/Project2.app/Contents/MacOS/Project2
Expected in: /usr/local/lib/libhidlib.dylib

下面是我链接库的代码:

unit Unit1;

interface

uses
System.SysUtils, System.Types, System.UITypes, System.Classes,     System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

{$IFDEF MSWINDOWS}
function DeleteAll():shortstring; stdcall; external 'Project1.dll' delayed;
{$ENDIF}
{$IFDEF MACOS}
function _DeleteAll():shortstring; cdecl; external 'libhidlib.dylib'  ;
{$ENDIF}

 var
 Form1: TForm1;

 implementation
jogvjijk

jogvjijk1#

所以,经过几个星期的信息搜索我发现,后释放新的OS X版本的程序员改变了OS X的文件结构(10.9 100%)
Delphi 怎么样。项目可以连接到库,但不能使用它的方法。

相关问题