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

查看:247
本文介绍了在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天全站免登陆