Static library for Mac OS

1.6k views Asked by At

I wrote a C++ static lib for Mac OS. It is for application run with smart card. Therefore, it used PCSC.framework. During compiling mylib, there is no problem and a static lib is derived. I created an application which was command line tool. I added my static lib to the application. When i created an instance from one class of the lib and called a method of the instance, i took errors undefined symbols for arcitecture x86_64: SCardConnect, SCardEstablishContext and the other pcsc functions

To solve these errors, i tried followings;

I rebuilt the static lib after changing architectures 32-bit intel from 64 bit. Then i also rebuilt test application. But errors were continued similary. Just difference from the earlier, undefined symbols for arcitecture i386.

I have PCSC for both arcitectures x86_64 and i386. libccid was for i386. i run pcsctest correctly.

Please let me know how i can solve it.

1

There are 1 answers

0
peacefulcoder On

Building the static library doesn't link and resolve all the symbols of the framework. Take a look at the following similar questions:

Some alternatives to consider are:

  • Including PCSC.framework as a framework dependency of your application as you did with your library.
  • Creating a framework or dynamic library instead of a static library.
  • Calling dlopen/dlsym on PCSC.framework.