在 MonoTouch 中包含 ImageMagick
在 MonoTouch 中使用 ImageMagick 的最佳方式是什么?
添加 ImageMagickNET 库似乎会在运行时产生错误,例如:
方法 '模块:CrtImplementationDetails.DoDllLanguageSupportValidation 汇编中的 ()' '/ImageMagickNET/bin/ReleaseQ8/ImageMagickNET.dll' 包含不能的本机代码 由Mono在此平台上执行。这 程序集可能是使用创建的 C++/CLI。
有特定于 iPhone 的二进制文件可用,我想我必须链接整个库,如下所述:
http:// monotouch.net/Documentation/Binding_New_Objective-C_Types
?
感谢您的帮助 :)
What's the best way to use ImageMagick in MonoTouch?
Adding the ImageMagickNET lib seems to produce errors during runtime, such as:
Method
'Module:CrtImplementationDetails.DoDllLanguageSupportValidation
()' in assembly
'/ImageMagickNET/bin/ReleaseQ8/ImageMagickNET.dll'
contains native code that cannot be
executed by Mono on this platform. The
assembly was probably created using
C++/CLI.
There are iPhone-specific binaries available, I suppose I have to link the whole library as described here:
http://monotouch.net/Documentation/Binding_New_Objective-C_Types
?
Thank you for your help :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,为什么这不起作用。
其次,你可以做些什么。
为什么它不起作用:您使用的库是使用 C++/CLI 编译器针对 Microsoft 库进行编译的。
您在 MonoTouch 中使用的所有托管代码都必须使用 MonoTouch 的程序集和工具进行编译,因此上述内容将不起作用,原因有两个:(a) Mono 缺少 C++/CLI 编译器,(b) 即使存在,您也必须引用Mono 组件
你能做什么:你可以使用 Apple 的 C 编译器构建 ImageMagic,然后将生成的代码链接到你的应用程序中:
http://monotouch.net/Documentation/Linking_Native_Libraries
然后,对于您要访问的每个 ImageMagick 方法,您需要使用 P/Invoke 对其进行包装,此处提供了指南:
http://www.mono-project.com/Interop_with_Native_Libraries
First, why this does not work.
Second, what you can do about it.
Why it does not work: The library that you are using is compiled with C++/CLI compiler against the Microsoft libraries.
All managed code that you use in MonoTouch must be compiled using MonoTouch's assemblies and tools, so the above wont work for two reasons: (a) Mono lacks a C++/CLI compiler and (b) even if that existed, you would have to reference the Mono asseblies
What can you do about it: You can build ImageMagic with Apple's C compiler, and then link the resulting code into your application:
http://monotouch.net/Documentation/Linking_Native_Libraries
Then for each ImageMagick method that you want to access, you need to wrap it using P/Invoke, a guide is available here:
http://www.mono-project.com/Interop_with_Native_Libraries
该错误回答了您的问题:
快速谷歌告诉我 imagemagick codeplex 页面
您可能正在使用所谓的“包装器”。
这意味着 imagemagick 代码本身仍然是非 .NET imagemagick,它永远不会在您的 iPhone 上运行。
that error answers your question for you :
A quick google tells me on the imagemagick codeplex page
that you're probably using what is called a 'wrapper'.
this means that the imagemagick code itself is still non-.NET imagemagick, which will never run on your iPhone.