ANARI-SDK
ANARI-SDK copied to clipboard
Need to move anariGetObjectFeatures definition to the API.cpp implementation file
Need to move the anariGetObjectFeatures
and anariGetInstanceFeatures
definitions from the header file (anari_feature_utility.h
) to the appropriate implementation file (API.cpp
??). Having the definitions in the header file causes a multiple definition
error when trying to #include <anari/anari_cpp.hpp>
as the definitions will appear in multiple places and the linker doesn't like it.
I guess so, for the moment they use a STB style ANARI_FEATURE_UTILITY_IMPL
macro to place the defininitions. As long as only one cpp file defines that before including it, it should be fine. I guess the other option would be to just make the functions static.
I'm not sure if "hardwiring" it into the sdk is the correct path. The utility to generate this helper is intentionally written so you could create a custom one with additional (vendor or extension provided) features in it.
It doesn't need to go in the SDK, however the current setup doesn't work when ANARI_FEATURE_UTILITY_IMPL
is defined in a header file. Making them static functions may be the best solution. In the words of Jakob
it just seems weird to have to define ANARI_FEATURE_UTILITY_IMPL
first in order to get the list of features from a device when, presumably, all front-ends will need to do this considering the direction the spec is going.
Workaround: I created my own GetAnariDeviceFeatures
method that returns an anari::Features
object that gets updated after processing a list of feature strings returned by anariGetObjectInfo
.
Closing this as the STB-style usage is the current intention and alternatives introduce link dependencies we want to avoid. Applications should only define ANARI_FEATURE_UTILITY_IMPL
in a single .cpp
translation unit to ensure a single definition.