Skip to content

Commit

Permalink
Remove unnecessary DllMain() definitions.
Browse files Browse the repository at this point in the history
Unless actually doing stuff, the compiler/linker generated default version
(which returns TRUE) is sufficient.

The main effect of having these empty yet lengthly definitions appears to be
that people copy and paste them to new device adapters, further cluttering our
code. It also obscures those few cases in which things are actually done in
DllMain().

git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@12458 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd
  • Loading branch information
mark committed Dec 23, 2013
1 parent 1883edf commit 4fffa0f
Show file tree
Hide file tree
Showing 51 changed files with 37 additions and 1,016 deletions.
22 changes: 0 additions & 22 deletions DeviceAdapters/ABS/dllmain.cpp
Expand Up @@ -5,29 +5,7 @@
#include "MMDeviceConstants.h"
#include "ABSCamera.h"

HDEVMODULE g_hLibraryHandle = 0;

// TODO: linux entry code

// windows DLL entry code
#ifdef WIN32
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
g_hLibraryHandle = hModule; // remeber module handle
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif
///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
///////////////////////////////////////////////////////////////////////////////
Expand Down
18 changes: 0 additions & 18 deletions DeviceAdapters/AOTF/AOTF.cpp
Expand Up @@ -54,24 +54,6 @@ short _stdcall Inp32(short PortAddress);
void _stdcall Out32(short PortAddress, short data);


#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif

///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
///////////////////////////////////////////////////////////////////////////////
Expand Down
19 changes: 0 additions & 19 deletions DeviceAdapters/AgilentLaserCombiner/AgilentLaserCombiner.cpp
Expand Up @@ -34,25 +34,6 @@ const char* g_fiber_2 = "Fiber 2";
// The virtual shutter device uses this global variable to restore state of the switch



#ifdef WIN32
// Windows dll entry routine
bool APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/ ) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif


///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
///////////////////////////////////////////////////////////////////////////////
Expand Down
18 changes: 1 addition & 17 deletions DeviceAdapters/Andor/Andor.cpp
Expand Up @@ -153,23 +153,7 @@ unsigned int AndorCamera::refCount_ = 0;
// global Andor driver thread lock
MMThreadLock g_AndorDriverLock;

// kdb 2/27/2009
#ifdef WIN32
// Windows dll entry routine
bool APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/ ) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#else
#ifndef WIN32
#include <sys/times.h>
#define WORD ushort
long GetTickCount()
Expand Down
17 changes: 0 additions & 17 deletions DeviceAdapters/AndorSDK3/AndorSDK3.cpp
Expand Up @@ -75,23 +75,6 @@ static const unsigned int CID_FIELD_SIZE = 4;
static const unsigned int NUMBER_MDA_BUFFERS = 10;
static const unsigned int NUMBER_LIVE_BUFFERS = 2;

// TODO: linux entry code

// windows DLL entry code
#ifdef WIN32
BOOL APIENTRY DllMain(HANDLE/*hModule*/, DWORD ul_reason_for_call, LPVOID/*lpReserved*/)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif

///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
Expand Down
21 changes: 0 additions & 21 deletions DeviceAdapters/Apogee/Apogee.cpp
Expand Up @@ -50,27 +50,6 @@ const char* g_PixelType_8bit = "8bit";
const char* g_PixelType_12bit = "12bit";
const char* g_PixelType_16bit = "16bit";

// TODO: linux entry code?

// Windows DLL entry routine
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/
)
{
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif


///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
Expand Down
19 changes: 0 additions & 19 deletions DeviceAdapters/BaumerOptronic/BaumerOptronic.cpp
Expand Up @@ -139,25 +139,6 @@ unsigned short iCode_g;
bool seqactive_g = false;


// windows DLL entry code
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif

///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
///////////////////////////////////////////////////////////////////////////////
Expand Down
19 changes: 0 additions & 19 deletions DeviceAdapters/DTOpenLayer/DTOpenLayer.cpp
Expand Up @@ -47,25 +47,6 @@ unsigned g_shutterState = 0;

using namespace std;

// global constants

#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif

#include "../../../3rdparty/DataTranslation/SDK/include/olmem.h"
#include "../../../3rdparty/DataTranslation/SDK/include/olerrors.h"
Expand Down
24 changes: 0 additions & 24 deletions DeviceAdapters/DemoCamera/DemoCamera.cpp
Expand Up @@ -62,30 +62,6 @@ const char* g_PixelType_32bitRGB = "32bitRGB";
const char* g_PixelType_64bitRGB = "64bitRGB";
const char* g_PixelType_32bit = "32bit"; // floating point greyscale

// TODO: linux entry code

// windows DLL entry code
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif





///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
Expand Down
18 changes: 0 additions & 18 deletions DeviceAdapters/DirectElectron/src/DECamera/DECamera.cpp
Expand Up @@ -69,24 +69,6 @@ const unsigned long DE_minimal_communication_timeout = 30; // seconds of minimal
// Custom error for custom messages
#define DEVICE_CUSTOM_ERROR 36

// windows DLL entry code
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif

///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
Expand Down
25 changes: 6 additions & 19 deletions DeviceAdapters/FLICamera/FLICamera.cpp
Expand Up @@ -70,36 +70,23 @@ const char* g_Keyword_CameraSerial = "CameraSerial";
ret = DEVICE_ERR; \
if (a != false) break; } }

// TODO: linux entry code

#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/
)
BOOL APIENTRY DllMain(HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/)
{
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
FLILibAttach();
break;

case DLL_THREAD_ATTACH:
break;

case DLL_THREAD_DETACH:
break;

break;
case DLL_PROCESS_DETACH:
FLILibDetach();
break;

default:
break;
break;
}
return TRUE;
}
#endif


MODULE_API void InitializeModuleData()
{
Expand Down
19 changes: 0 additions & 19 deletions DeviceAdapters/FreeSerialPort/FreeSerialPort.cpp
Expand Up @@ -42,25 +42,6 @@ const char* g_DeviceName = "FreeSerialPort";
#define ERR_DEVICE_NOT_FOUND 10005



#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif

///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
///////////////////////////////////////////////////////////////////////////////
Expand Down
23 changes: 0 additions & 23 deletions DeviceAdapters/IDS_uEye/IDS_uEye.cpp
Expand Up @@ -63,29 +63,6 @@ const char* g_PixelType_32bit = "32bit"; // floating point greyscale
*/


// TODO: linux entry code

// windows DLL entry code
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif



//definitions
#define ACQ_TIMEOUT 200 //timeout for image acquisition (in 10ms)

Expand Down
16 changes: 0 additions & 16 deletions DeviceAdapters/ITC18/MMITC18.cpp
Expand Up @@ -71,22 +71,6 @@ std::string g_range = g_ITC18_AD_RANGE_10VString;

void *itc;

#ifdef WIN32
// Windows dll entry routine
bool APIENTRY DllMain( HANDLE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID /*lpReserved*/ ) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif

///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
Expand Down

0 comments on commit 4fffa0f

Please sign in to comment.