3 * Copyright (C) 2018-2023 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #ifndef CARLA_MAC_UTILS_HPP_INCLUDED
19 #define CARLA_MAC_UTILS_HPP_INCLUDED
25 #include "CarlaBackend.h"
27 // don't include Foundation.h here
29 typedef struct __CFBundle
* CFBundleRef
;
30 typedef const struct __CFString
* CFStringRef
;
31 void* CFBundleGetFunctionPointerForName(CFBundleRef
, CFStringRef
);
34 CARLA_BACKEND_START_NAMESPACE
36 // --------------------------------------------------------------------------------------------------------------------
41 CARLA_API
void initStandaloneApplication();
46 CARLA_API
const char* findBinaryInBundle(const char* const bundleDir
);
51 CARLA_API
bool removeFileFromQuarantine(const char* const filename
);
53 // --------------------------------------------------------------------------------------------------------------------
58 class AutoNSAutoreleasePool
{
60 AutoNSAutoreleasePool();
61 ~AutoNSAutoreleasePool();
67 // --------------------------------------------------------------------------------------------------------------------
72 bool load(const char* const filename
);
73 CFBundleRef
getRef() const noexcept
;
75 template<typename Func
>
76 inline Func
getSymbol(const CFStringRef name
) const
78 return reinterpret_cast<Func
>(CFBundleGetFunctionPointerForName(getRef(), name
));
83 PrivateData
* const pData
;
86 // --------------------------------------------------------------------------------------------------------------------
88 CARLA_BACKEND_END_NAMESPACE
90 #endif // CARLA_MAC_UTILS_HPP_INCLUDED