在 Mac 上创建 .dll:.dylib 还是框架? [英] creating a .dll on a mac: .dylib or framework?

查看:27
本文介绍了在 Mac 上创建 .dll:.dylib 还是框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为我们的一位客户创建一个 Mac 版本的库.我对 Mac 上的动态库不太熟悉,但据我了解,我有 2 个选项:.dylib 或框架.什么是最好的选择?为什么?

I need to create a Mac version of our libraries for one of our customers. I am not so familiar with dynamic libraries on Mac, but from what I understand, I have 2 options: .dylib or frameworks. What would be the best option? Why?

几个相关问题:

  • 如果我理解正确,.dylib 必须安装在标准 UNIX 目录之一中,例如/usr/lib 等.因此,使用 .dylib 应该会使我客户的安装程序更加复杂,因为他们可能需要请求权限才能在系统文件夹中写入内容?
  • 框架可以是私有的并嵌入到我客户的捆绑包中吗?所以没有其他人可以看到/使用它们?
  • If I understand correctly, .dylib have to be installed in one of the stnadard UNIX directories such as /usr/lib, etc. Hence using a .dylib should make my customer's installer much more complex, since they'll probably need to request permission to write something in a system folder?
  • Can frameworks be private and embedded within my customer's bundle? So no one else can see/use them?

欢迎提出任何建设性的批评/意见/想法.提前致谢.

Any constructive criticisms/comments/ideas more than welcome. Thanks in advance.

亚历克斯

推荐答案

.dylib 类似于 Linux 上的 .so.

.dylib is similar to .so on Linux.

框架基本上只是 OSX 将库和头文件一起分发的方式.它们是库分发的等效应用程序包.

Frameworks are basically just the OSX way of distributing libraries and headers together. They are the Application Bundle equivalent for library distribution.

如果您想确保其他人不使用任何一种方法,您应该使用 静态库(.a 文件)并让您的客户静态链接他们进入他们的应用程序.

With either method if you want to ensure other people don't use them you should be using static libraries (.a files) and getting your customer to statically link them into their application.

否则,Framework 和 .dylib 之间并没有太大区别,只是先验对于 OSX 开发人员来说更好.

Otherwise there isn't really much difference between Frameworks and .dylib except the prior is nicer for OSX developers.

两者都可以嵌入到客户应用程序包中,otool/install_name_tool 都可以很好地处理它们.

Either can be embedded inside a customers Application bundle, otool/install_name_tool handle them both fine.

这篇关于在 Mac 上创建 .dll:.dylib 还是框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆