Browse Source

Initialize win32 stuff on discovery tools too

tags/v1.9.11
falkTX 7 years ago
parent
commit
b67bde5a0c
2 changed files with 34 additions and 1 deletions
  1. +1
    -1
      source/discovery/Makefile
  2. +33
    -0
      source/discovery/carla-discovery.cpp

+ 1
- 1
source/discovery/Makefile View File

@@ -35,7 +35,7 @@ BUILD_CXX_FLAGS += -ObjC++
endif endif


ifeq ($(WIN32),true) ifeq ($(WIN32),true)
LINK_FLAGS += -mwindows
LINK_FLAGS += -lole32 -mwindows
endif endif


32BIT_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_ALTERNATIVE_ARCH 32BIT_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_ALTERNATIVE_ARCH


+ 33
- 0
source/discovery/carla-discovery.cpp View File

@@ -33,6 +33,11 @@
# import <Foundation/Foundation.h> # import <Foundation/Foundation.h>
#endif #endif


#ifdef CARLA_OS_WIN
# include <pthread.h>
# include <objbase.h>
#endif

#ifdef HAVE_FLUIDSYNTH #ifdef HAVE_FLUIDSYNTH
# include <fluidsynth.h> # include <fluidsynth.h>
#endif #endif
@@ -1411,6 +1416,21 @@ int main(int argc, char* argv[])
openLib = false; openLib = false;
#endif #endif


// ---------------------------------------------------------------------
// Initialize OS features

#ifdef CARLA_OS_WIN
OleInitialize(nullptr);
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
# ifndef __WINPTHREADS_VERSION
// (non-portable) initialization of statically linked pthread library
pthread_win32_process_attach_np();
pthread_win32_thread_attach_np();
# endif
#endif

// ---------------------------------------------------------------------

if (openLib) if (openLib)
{ {
handle = lib_open(filename); handle = lib_open(filename);
@@ -1428,6 +1448,8 @@ int main(int argc, char* argv[])
if (doInit && getenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS") != nullptr) if (doInit && getenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS") != nullptr)
doInit = false; doInit = false;


// ---------------------------------------------------------------------

if (doInit && openLib && handle != nullptr) if (doInit && openLib && handle != nullptr)
{ {
// test fast loading & unloading DLL without initializing the plugin(s) // test fast loading & unloading DLL without initializing the plugin(s)
@@ -1480,6 +1502,17 @@ int main(int argc, char* argv[])
if (openLib && handle != nullptr) if (openLib && handle != nullptr)
lib_close(handle); lib_close(handle);


// ---------------------------------------------------------------------

#ifdef CARLA_OS_WIN
#ifndef __WINPTHREADS_VERSION
pthread_win32_thread_detach_np();
pthread_win32_process_detach_np();
#endif
CoUninitialize();
OleUninitialize();
#endif

return 0; return 0;
} }




Loading…
Cancel
Save