Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to move anariGetObjectFeatures definition to the API.cpp implementation file #63

Closed
griffin28 opened this issue Aug 25, 2022 · 4 comments

Comments

@griffin28
Copy link
Collaborator

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.

@progschj
Copy link
Collaborator

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.

@griffin28
Copy link
Collaborator Author

griffin28 commented Aug 26, 2022

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.

@griffin28
Copy link
Collaborator Author

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.

@jeffamstutz
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants