Re: Dynamic Linking
Re: Dynamic Linking
- Subject: Re: Dynamic Linking
- From: Sherm Pendley <email@hidden>
- Date: Wed, 27 Mar 2002 19:42:23 -0500
On Wednesday, March 27, 2002, at 11:21 AM, Jason Moore wrote:
Where in ProjectBuilder do i add the libcrypto.dylib file?
Under "linker settings"/"other linker flags", you'll need to add the
flags to link in that library: "-lcrypto".
Note that the leading "lib" is omitted, as is the extension. If both
dynamic ".dylib" and static ".a" libraries are found, the default is
dynamic linking.
What #include should i use (<crypto/crypto.h>?)?
If you're following Alex' advice from earlier, and grabbing the headers
from the source distribution of openssl, you could just drop the header
you need into your project folder, and use:
#include "crypto.h"
Or, you could put them in a directory of their own, for example
/usr/include/crypto. In that case, you'd need to use:
#include <crypto/crypto.h>
The first "crypto" in this example specifies a directory under
"/usr/include", not the name of the library. This is one way in which
#include works differently than #import. Also worth noting is the use of
quotes vs. angle brackets; if quotes are used, only the directory
containing the file being compiled is searched for the header, while if
angle brackets are used, the header search path is used.
After examining the contents of /usr/lib/ i found the following four
libraries:
libcrypto.0.9.dylib
libcrypto.dylib
libssl.0.9.dylib
libssl.dylib
which should i use to get all the crypto functions of OpenSSL
(differences?)?
That's actually only two libraries. The libraries without version
numbers are symbolic links; they're there so that you can link against
these libraries without worrying about the version number.
When in doubt - link them both. That is, include both "-lcrypto" and
"-lssl" in your linker options. The linker is pretty smart. It won't
link against a library if nothing from that library is used. Even if
static linking is used, it only copies the functions that are actually
used into your executable, rather than the entire library.
sherm--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.