作者热门文章
- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我正在为 ruby 开发一个 C 扩展,但我需要包含来自 IOBluetooth
框架的 header ,特别是:
#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h>
#import <IOBluetooth/IOBluetoothUserLib.h>
一切都编译正常,但在运行时,扩展错误:
path/to/file.rb:1:in `require_relative': dlopen(/path/to/extension.bundle, 9):
Symbol not found: _OBJC_CLASS_$_IOBluetoothDeviceInquiry (LoadError)
我相当确定这与未包含在链接过程中的框架有关,但我不确定原因。任何帮助将不胜感激
extconf.rb
:
# Loads mkmf which is used to make makefiles for Ruby extensions
require 'mkmf'
# Give it a name
extension_name = 'bluetooth'
dir_config(extension_name)
create_makefile(extension_name, 'bluetooth')
生成的 MakeFile: http://paste.wilhall.com/25
更新:我修改了 Makefile 以便库静态链接;仍然遇到同样的错误,但这次是在链接时。
奇怪的是,我的 extconf.rb
文件中的 have_header
可以正常找到这些头文件。
更新:我从系统日志文件中提取了以下内容:
Process: ruby [951]
Path: /usr/local/bin/ruby
Identifier: ruby
Version: 0
Code Type: X86-64 (Native)
Parent Process: bash [468]
User ID: 501
Date/Time: 2012-10-17 14:06:57.425 -0400
OS Version: Mac OS X 10.8.1 (12B19)
Report Version: 10
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000010
如果我没记错的话,EXC_BAD_ACCESS (SIGABRT)
通常与 GC 问题有关?将调查并发布结果
最佳答案
这看起来太简单了,所以我可能会离开,但从你发布的内容来看它看起来是正确的。看起来问题不在于 header ,而是您没有链接 IOBluetooth 框架本身。您是否在任何地方指定了诸如 -framework IOBluetooth
之类的内容?
关于objective-c - 将 Cocoa header 链接到 ruby C 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12887639/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!