Activating Dext from C++

How can a Dext be activated from C++. Specifically we need to load our Dext from our c++ CoreAudio server plugin. I guess it all boils down to how to call the OSSystemExtensionRequest Swift interface from C++... Thanks for any hints!

Answered by Frameworks Engineer in 787506022

Hi hagen

The OSSystemExtensionManager and OSSystemExtensionRequest APIs are Objective-C APIs. They can be called from Swift, Objective-C, and Objective-C++ code.

You mention having an existing C++ codebase, so it should straightforward for you to add a new Objective-C++ source file to your project from which you can interface with the full range of Objective-C APIs and your existing C++ source code. You can add a new Objective-C++ source file by creating a new C++ source file and changing the file extension to .mm. Alternatively, you can change one of your existing C++ file extensions to .mm. Objective-C++ is a superset of C++. Existing C++ code should continue to compile in an Objective-C++ source file.

Specifically we need to load our Dext from our c++ CoreAudio server plugin.

I haven't tested this myself, but I would not be surprised if OSSystemExtensionRequest can not be used from within a CoreAudio server plugin. The guidance is that requesting installation of a system extension (include DEXTs) is handled by your main application.

https://developer.apple.com/documentation/systemextensions/installing-system-extensions-and-drivers?language=objc

Enlightening! So, where is the documentation?

Accepted Answer

Hi hagen

The OSSystemExtensionManager and OSSystemExtensionRequest APIs are Objective-C APIs. They can be called from Swift, Objective-C, and Objective-C++ code.

You mention having an existing C++ codebase, so it should straightforward for you to add a new Objective-C++ source file to your project from which you can interface with the full range of Objective-C APIs and your existing C++ source code. You can add a new Objective-C++ source file by creating a new C++ source file and changing the file extension to .mm. Alternatively, you can change one of your existing C++ file extensions to .mm. Objective-C++ is a superset of C++. Existing C++ code should continue to compile in an Objective-C++ source file.

Specifically we need to load our Dext from our c++ CoreAudio server plugin.

I haven't tested this myself, but I would not be surprised if OSSystemExtensionRequest can not be used from within a CoreAudio server plugin. The guidance is that requesting installation of a system extension (include DEXTs) is handled by your main application.

https://developer.apple.com/documentation/systemextensions/installing-system-extensions-and-drivers?language=objc

Activating Dext from C++
 
 
Q