CorePlot MonoMac绑定崩溃 [英] CorePlot MonoMac bindings crashing
问题描述
我试图将CorePlot 0.9绑定用于monomac,但这似乎是一项艰巨的任务。 monotouch示例可以构建并运行,没有任何问题,但是我不需要那个。
I am trying to use the CorePlot 0.9 binding for monomac, but that seems to be a hard task. The monotouch sample builds and runs without any problems, but I don't need that one.
由于绑定中仅存在CorePlotiOS.dll,因此我必须构建一个用于osx本人,但是首先,不存在bmake.exe,因此我必须下载monomac源码并自己首先构建它。然后,我尝试构建CorePlotOSX.dll,但这导致了一些编译问题。看着单声道触摸的构建脚本,我尝试使用以下命令:
Since only a CorePlotiOS.dll was present in the binding, I had to build one for osx myself, but first of af all, no bmake.exe was present, so I had to download the monomac source and build it myself first. Then I tried to build the CorePlotOSX.dll but that caused some compilation problems. Looking at the build-script for mono touch I tried with this line instead:
MONO_PATH=$(MONOMAC)/src mono $(MONOMAC)/src/bmac.exe -e -unsafe coreplot.cs -s=enums.cs -x=extras.cs -x=AssemblyInfo.cs --sourceonly=list --tmpdir=osx -r:System.Drawing -r:MonoMac -lib:$(MONOMAC)/src -baselib:$(MONOMAC)/src/MonoMac.dll .
那里有什么问题吗?
我有将问题简化为:
graph = new CPTPieChart();
graph.Title = "Test";
分配似乎可以保留,但是每当我尝试访问该对象时,我都会崩溃:
The allocation seems to survive, but whenever I try to access the object, I crash:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000bf887fac
VM Regions Near 0xbf887fac:
Stack 00000000b038d000-00000000b040e000 [ 516K] rw-/rwx SM=COW
--> Stack 00000000bc088000-00000000bf888000 [ 56.0M] ---/rwx SM=NUL
Stack 00000000bf888000-00000000c0088000 [ 8192K] rw-/rwx SM=COW
Application Specific Information:
objc[17645]: garbage collection is OFF
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreFoundation 0x97c8aebc __CFStringEncodeByteStream + 12
1 com.apple.Foundation 0x9ac8ed49 -[NSString(NSStringOtherEncodings) getBytes:maxLength:usedLength:encoding:options:range:remainingRange:] + 263
2 com.apple.Foundation 0x9ac8e8ee bytesInEncoding + 213
3 com.apple.Foundation 0x9ac8e814 -[NSString(NSStringOtherEncodings) UTF8String] + 42
4 com.apple.CoreFoundation 0x97ce478c -[__NSCFString UTF8String] + 204
5 ??? 0x00f91208 0 + 16323080
6 ??? 0x030d708c 0 + 51212428
7 ??? 0x030d703c 0 + 51212348
8 ??? 0x016877d4 0 + 23623636
有什么想法吗?运行Mac OSX 10.7.5 btw。
Any ideas? Running Mac OSX 10.7.5 btw.
推荐答案
好的,这很困难。经过几天与xcode和monomac的对抗,事实证明,没有加载本机CorePlot框架(动态库)。我不知道自己应该自己加载它(我是monomac新手,对不起...但是它不是很丑,它以这种方式无声地失败了吗?)
Ok, that was hard. After several days of fighting xcode and monomac, it turned out, that the native CorePlot framework (dynamic lib) was not loaded. I was not aware, that I was supposed to load it myself (I am a monomac newbie, sorry...but isn't it rather ugly it fails silently in that way??)
执行此操作的两种方式:
Two ways to do this: either
Dlfcn.dlopen ("CorePlot.framework/CorePlot", 2); // 2 = load now, 0 = lazy load
或 [assembly: MonoMac.RequiredFramework( CorePlot.framework / CorePlot)]
这篇关于CorePlot MonoMac绑定崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!