Closed wassimj closed 2 years ago
The problem isn't with the string, but with the TopologicCore library having failed to load. That is, this function: void* TopologicCore::StringAttribute::Value(void)
is missing which I presume is in libToplogicCore.dll
?
(The string not being retrieved afterwards is a red herring: if the wrapper function fails to link, it simply returns a null value to prevent crashing when inspecting the result.)
Given that the CPyCppyy API was also not found, I suspect other installation issues. Is this code run from Blender? (There's a long thread on that one back on bitbucket.)
But the strange thing is that other methods within the same run are working perfectly and they all are within TopologicCore. So for example they can retrieve the value if it is a float or int, but not if it is a string. Even on my machine the CPyCppy API is not found, but I don’t face this issue. And finally, yes this is all through Blender. Thanks
IIRC, IntAttribute
etc. were pythonized to use IntValue
etc. rather than Value
. I note that in the headers methods such as IntValue
are inline and thus visible to the compiler, no need for the linker to find them. The Value
methods OTOH are out-of-line, so need to be linked. Windows requires all symbols used externally to a DLL to be exported. I see that the StringAttribute
constructor is marked with TOPOLOGIC_API
, but Value
is not?
Any reason to not simply export the whole class? (I.e. declare the class with TOPOLOGIC_API
?)
A favour: can you please do a pull request at github.com/wassimj/Topologic so that the code is exactly as you think it should be? Many thanks!
I'd recommend simply exporting all symbols, such that the behavior on Windows is the same as on Linux and Mac. Use of cmake, which TopologicCore already does, makes that easy: https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html
Alternatively, add that TOPOLOGIC_API
to each class that need exporting, just after the class
keyword. I.e.: class TOPOLOGIC_API StringAttribute ...
.
Or finally, export that one function that is giving trouble here: TOPOLOGIC_API virtual void* Value();
in both StringAttribute
and the Attribute
base class (presumably, that will force the same in all Attribute
derived classes, but I haven't tried (still no Windows box, although I now have an Intel Macbook on which I can run VMWare).
Presumed resolved after no feedback for more than a month.
Hi, I distributed Topologic along with cppyy to three people and they all had VS 2019 installed and it worked fine, but they have encountered the following error which I do not see on my installation. Any hints on why this may be happening on their machines, but not mine? Is there something I can fix in my C++ code to avoid all this? This happens when they try to get a string value back from a dictionary. Thanks