[Nexus] Problems compiling Nexus library as DLL on Windows

Mark Rivers rivers at cars.uchicago.edu
Fri Aug 23 14:23:24 BST 2013


Hi Freddie,

Thanks for the suggestion.

I tried that and it did not work.  However, by studying the H5api_adpt.h file I found that if I defined H5_BUILT_AS_DYNAMIC_LIB then it fixed my problem, because that in turn defines _HDFUSEDLL_ within the correct #ifdef block.

Thanks,
Mark


________________________________________
From: freddie.akeroyd at stfc.ac.uk [freddie.akeroyd at stfc.ac.uk]
Sent: Friday, August 23, 2013 2:02 AM
To: nexus at nexusformat.org; Mark Rivers
Subject: RE: [Nexus] Problems compiling Nexus library as DLL on Windows

Mark,

Is the preprocessor symbol -HDF5USEDLL- (for - read underscore, my keyboard is playing up) defined when you compile the nexus source?

Regards,

Freddie
________________________________
From: Pete Jemian<mailto:jemian at anl.gov>
Sent: ‎23/‎08/‎2013 04:33
To: Mark Rivers<mailto:rivers at cars.uchicago.edu>
Cc: nexus at nexusformat.org<mailto:nexus at nexusformat.org>
Subject: Re: [Nexus] Problems compiling Nexus library as DLL on Windows

Mark:

I'm not much of an expert on compiling the NAPI but the NeXus community
is.  I'm going to forward this thread to them.  Perhaps one of them has
encountered this situation before.

Rather than cross the EPICS tech-talk list with this addition, perhaps
you might forward back to tech-talk the summary of any responses you get
from the tech committee.

Pete


On 8/22/2013 10:21 PM, Mark Rivers wrote:
> I have identified the problem, but have not solved it.
>
> The file  H5Tpublic.h contains definitions like the following:
>
> H5_DLLVAR hid_t H5T_NATIVE_UINT32_g;
>
> The problem is that when H5Tpublic.h is being included the macro H5_DLLVAR is not correctly defined to be "__declspec(dllimport)".   Rather H5_DLLVAR appears to be defined as "extern".  This causes the linker to be unable to locate these symbols, even though they are correctly exported by the .lib file.
>
> I just need to figure out why H5_DLLVAR is not being correctly defined in H5api_adpt.h.  It looks like it should be, but clearly I am doing something wrong.
>
> Mark
>
>
> ________________________________
> From: Mark Rivers
> Sent: Thursday, August 22, 2013 2:56 PM
> To: Pete R Jemian; Jan Ilavsky; 'Mark Koennecke'; Madden, Timothy J.; 'Tobias.Richter at diamond.ac.uk'; 'ulrik.pedersen at diamond.ac.uk'; 'Glowacki, Arthur T.'; Schwarz, Nicholas
> Cc: tech-talk at aps.anl.gov
> Subject: Problems compiling Nexus library as DLL on Windows
>
> Folks,
>
> The EPICS areaDetector software has been successfully using the HDF5 library (1.8.7) on Windows since R1-7, about 2 years ago.  However, only the statically linked version of the library was installed, which meant that areaDetector applications needed to be statically linked.
>
> I am now writing a driver that must be dynamically linked, because it uses the Microsoft Common Library Runtime (/clr switch on linker).  So I want to also install and use the dynamic version of the HDF5 library.  I installed the dynamic versions of the required .lib files from HDF5-1.8.7_CMake_x64_shared.zip, from the HDF Web site.
>
> When I try to build the ADApp\nexusSrc directory it compiles fine, but I get these errors it tries to link the DLL.   Does anyone know what I am doing wrong?
>
> J:\epics\devel\areaDetector\ADApp\nexusSrc>make
> make -C O.windows-x64-dynamic -f ../Makefile TOP=../../.. T_A=windows-x64-dynamic install
> make[1]: Entering directory `J:/epics/devel/areaDetector/ADApp/nexusSrc/O.windows-x64-dynamic'
> link /nologo /subsystem:windows /dll /LTCG /incremental:no /opt:ref /release   /MACHINE:X64     /implib:NeXus.lib /out:NeXus.dll          napi.obj napi5.obj napiu.obj nxdataset.obj  nxio.obj nxstack.obj nxxml.obj stptok.obj      ..\\..\\..\\lib\\windows-x64-dynamic\\hdf5.lib  ..\\..\\..\\lib\\windows-x64-dynamic\\libszip.lib  ..\\..\\..\\lib\\windows-x64-dynamic\\zlib.lib
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_SHORT_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_INT32_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_INT_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_INT8_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_UINT64_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_USHORT_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_UINT_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_UCHAR_g
> napi5.obj : error LNK2001: unresolved external symbol H5P_CLS_DATASET_CREATE_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_SCHAR_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_FLOAT_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_UINT8_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_C_S1_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_INT16_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_UINT16_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_UINT32_g
> napi5.obj : error LNK2001: unresolved external symbol H5P_CLS_FILE_ACCESS_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_INT64_g
> napi5.obj : error LNK2001: unresolved external symbol H5T_NATIVE_DOUBLE_g
> NeXus.dll : fatal error LNK1120: 19 unresolved externals
> make[1]: *** [NeXus.dll] Error 1120
> make[1]: Leaving directory `J:/epics/devel/areaDetector/ADApp/nexusSrc/O.windows-x64-dynamic'
> make: *** [install.windows-x64-dynamic] Error 2
>
>
> Thanks,
> Mark
>
>

--
----------------------------------------------------------
Pete R. Jemian, Ph.D.                <jemian at anl.gov>
Beam line Controls and Data Acquisition, Group Leader
Advanced Photon Source,   Argonne National Laboratory
Argonne, IL  60439                   630 - 252 - 3189
-----------------------------------------------------------
    Education is the one thing for which people
       are willing to pay yet not receive.
-----------------------------------------------------------


_______________________________________________
NeXus mailing list
NeXus at nexusformat.org
http://lists.nexusformat.org/mailman/listinfo/nexus
--
Scanned by iCritical.



More information about the NeXus mailing list