dlclose and Objective C Runtime

Hi


We have found a problem creating VST plug-ins using Xcode 7.2

If the VST host loads then unloads the plug-in the host application will crash.


We have isolated the problem into a very simple example.


We have create a dynamic library that contains one C++ file and one .mm file. The .mm file does not contain any code. The C++ file contains a simple class which is statically initialised.


From the host application we load the lib using dlopen then close using dlclose. (We do not make any calls into the library)


The host application then tries to load an objective C window, but this fails and leads to a crash.


If we set the deployment target of the dynamic lib to 10.11 we do not get a crash.

If we set the deployment target to 10.6 to 10.10 we do get a crash.

If we remove the empty objective C file from the dynamic library we do not get a crash.


We think that when the dlclose function is call the objective C runtime in the host application is being corrupted.


We are testing using Xcode 7.2 and OS X 10.11.3 We have replaced the problem on multiple versions of OS X. The problem does to occur if we build with Xcode 4.6.


Any help would be appreciated!

Accepted Reply

We have found the solution.


We need to set


Implicitly Link Objective-C Runtime Support to NO


in the dynamic library xcode settings.

Replies

We have found the solution.


We need to set


Implicitly Link Objective-C Runtime Support to NO


in the dynamic library xcode settings.