deps.labjack: support building for windows

The only pthread functionality this seems to use is mutexes, which are
(fortunately) theoretically trivial to wrap for windows. This
compiles, though it is not clear if it actually works correctly.
This commit is contained in:
2024-07-01 19:28:30 -07:00
parent 7275d1c30e
commit c32390f7c1
3 changed files with 44 additions and 1 deletions

View File

@@ -23,7 +23,14 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#if defined(LJACKLM_USE_WINDOWS_MUTEX_SHIM)
#include <windows.h>
#include "windows_mutex_shim.h"
#else
#include <pthread.h>
#endif // LJACKLM_USE_WINDOWS_MUTEX_SHIM
#include "labjackusb.h"
@@ -286,7 +293,9 @@ long GetU12Information( HANDLE hDevice,
long *fcddMaxSize,
long *hvcMaxSize);
#if !defined(LJACKLM_USE_WINDOWS_MUTEX_SHIM)
unsigned long GetTickCount( void);
#endif
__attribute__((constructor))
@@ -7266,6 +7275,7 @@ long GetU12Information( HANDLE hDevice,
}
#if !defined(LJACKLM_USE_WINDOWS_MUTEX_SHIM)
//======================================================================
//GetTickCount: Implementation of GetTickCount() for Unix. Returns the
// current time, expressed as millisconds since the Epoch
@@ -7276,3 +7286,4 @@ unsigned long GetTickCount( void)
gettimeofday(&tv, NULL);
return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}
#endif