Can't use custom library compiled with ROOT6 under Windows

Hi,

I’m trying to use classes from a .dll created with nmake (works with ROOT5).

The .dll seems to compile just fine, the only warnings are:
C:\root_v6.20.00\include\TMath.h(619) : warning C28251: Inconsistent annotation for 'ldexp': this instance has no annotations. See c:\program files (x86)\windows kits\10\include\10.0.18362.0\ucrt\corecrt_math.h(513). C:\root_v6.20.00\include\TDictionary.h(192) : warning C6244: Local declaration of 'kNone' hides previous declaration at line '87' of 'c:\root_v6.20.00\include\guitypes.h'.: Lines: c:\root_v6.20.00\include\guitypes.h:87 C:\root_v6.20.00\include\TInterpreter.h(72) : warning C6244: Local declaration of 'kFatal' hides previous declaration at line '42' of 'c:\root_v6.20.00\include\terror.h'.: Lines: c:\root_v6.20.00\include\terror.h:42

The .dll is loaded in rootlogon.c and TClass::GetClass(“classname”)->HasDictionary() returns true.

However, when I try to call the classes in ROOT it complains:
IncrementalExecutor::executeFunction: symbol '?Streamer@classname@@UAEXAAVTBuffer@@@Z' unresolved while linking [cling interface function]! You are probably missing the definition of public: virtual void __thiscall classname::Streamer(class TBuffer &) Maybe you need to load the corresponding shared library? IncrementalExecutor::executeFunction: symbol '??0classname@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MH@Z' unresolved while linking [cling interface function]! You are probably missing the definition of public: __thiscall classname::classname(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,float,int) Maybe you need to load the corresponding shared library? IncrementalExecutor::executeFunction: symbol '?Class@classname@@SAPAVTClass@@XZ' unresolved while linking [cling interface function]! You are probably missing the definition of public: static class TClass * __cdecl classname::Class(void) Maybe you need to load the corresponding shared library?

The makefile does:
dict.cxx: some.h another.h linkdef.h @$(ROOTSYS)\bin\rootcint -f dict.cxx some.h another.h linkdef.h .cxx.obj: cl /DLL /MD /Zc:__cplusplus /FIw32pragma.h /FIsehmap.h /GR /W3 /wd4141 /wd4291 /wd4244 /wd4049 /D_XKEYCHECK_H /D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS /analyze:log logfile /EHsc /Ox /D "MSVC" /D "WIN32" -I$(ROOTSYS)\include -c $<

What could be wrong here?

Please let me know if you need additional information.

Thanks,
Chris


ROOT Version: root_v6.20.00.win32.vc16.debug.exe
Platform: Windows 10
Compiler: cl 19.24.28316


You might have to export the symbols, either by using the CMake flag WINDOWS_EXPORT_ALL_SYMBOLS with your library, or by using the bindexplib utility from ROOT, something like:

bindexplib $libname $objectfiles > $libname.def

and then, when linking, use the /def flag: /def:$libname.def

Hi,

the creation of the .def, .exp and .lib files with bindexplib works and doing so removes the error message
public: __thiscall classname::classname(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,float,int)

It seems like the reason for the other error messages was a missing definition of the destructor for this class. It seems to work now!

Thanks,
Chris

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.