It's not something that we've ever tested or would be likely to support, but 
essentially:

1) Convince CMake to build the unsupported thread-safe + static configuration. 
There should be an "enable unsupported" option for this.
2) Possibly modify the HDF5 source code since our #ifdefs might assume that 
thread-safety and shared builds are standard on Windows.
3) Call H5TS_win32_thread_enter/exit() in your own DllMain() code like we do in 
H5.c. Note that those are private functions, so you'll have to pull in our 
private headers.
4) If you plan on ever updating the version of HDF5 that we use, you'll need to 
hope we don't change the way we handle TLS in the future since you are using 
non-public-API functions.

I would definitely recommend against this, even if it can be made to work.

Cheers,

Dana

From: Hdf-forum [mailto:[email protected]] On Behalf Of David
Sent: Wednesday, November 4, 2015 4:01 PM
To: HDF Users Discussion List <[email protected]>
Subject: Re: [Hdf-forum] Building Static Thread Safe Libs

I'm actually building a dll so statically linked hdf5 would still able to use 
dll hooks. I just don't know how to get the build procedure to do it.

On Wed, Nov 4, 2015 at 12:54 PM, Dana Robinson 
<[email protected]<mailto:[email protected]>> wrote:
Hi David,

Since you say "dll" I'm going to assume you are on Windows. Thread-safety is 
not supported in static builds of HDF5 on Windows. The reason for this is that, 
unlike with Pthreads, we have to use the dll hooks to set up and tear down 
thread-local storage when Win32 threads are used. With no dll, there are no 
hooks.

Cheers,

Dana Robinson
Software Engineer
The HDF Group

From: Hdf-forum 
[mailto:[email protected]<mailto:[email protected]>]
 On Behalf Of David
Sent: Wednesday, November 4, 2015 3:49 PM
To: HDF Users Discussion List 
<[email protected]<mailto:[email protected]>>
Subject: [Hdf-forum] Building Static Thread Safe Libs

Is there any way to build a the static libs with thread safety turned on? I'm 
only using hdf5 in one binary so I'd rather not have to include an additional 
dll in my distribution.

Thanks,
David

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]<mailto:[email protected]>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to