Replies: 1 comment 1 reply
-
Suffixing everything in the API with a version number would make the most common use case of upgrading a dependent code base that uses a subset of the API, a single version at a time, more difficult. That kind of update is usually very straight forward because with the current approach most of the dependent code doesn't change at all. We have historically always tried to prioritize ease of use for our least expert users so that one can "pay as you go" up in complexity, if you will, rather than hit a wall of complexity already when trying to evaluate the software. For advanced applications like yours that require building against multiple PhysX / physics engines, the common pattern is to create a wrapper / abstraction layer that insulates your core engine from the physics library API completely. The best way to do this is to put this wrapper into a dynamic link library such that the all of the PhysX stuff not only ends up in its own compilation unit but its own executable which also gets around namespace but also CRT incompatibility problems. You may want to look at PEEL as an example project that supports multiple versions of PhysX: https://github.com/Pierre-Terdiman/PEEL_PhysX_Edition/tree/main/PEEL |
Beta Was this translation helpful? Give feedback.
-
TLDR:
My request is that, going forward, my software would be able to link against two versions of PhysX without me having to make substantial code changes to the PhysX code.
Explanation
I work with a large code base with many products that use PhysX. For each product a PhysX upgrade is expensive for two reasons. One is the API changes which require code to be tweaked or rewritten. The other is behavior changes which break regression tests. I'm not complaining that either of these changes exist. I can appreciate that forward progress means not being too tightly bound by what already exists.
However, we would like to be able to upgrade one product to PhysX 5 without having to upgrade all of them. For existing products (some 10 years old) there is less driver to upgrade the version of PhysX. The structure of our codebase means that all versions of PhysX that our products depend on need to be able to be linked together.
This creates a problem for us because PhysX was not designed with this use case in mind. Attempting to link against two versions of PhysX simultaneously would result in various naming conflicts or ODR violations.
When upgrading from PhysX 4 we solved this by
We're now faced with making the same changes again in PhysX 5 and I'm wishing I'd raised this issue when we upgraded to 4.
My request is that, going forward, my software would be able to link against two versions of PhysX without me having to make substantial code changes to the PhysX code. The specific changes that we've found need to be made are
I believe that this could be done less painfully on the PhysX side through the use of macros. I believe the existing use case that I'm sure others have of drop in replacement of PhysX versions (particularly minor updates) could still be achieved through the use of macros, namespace aliases, or minor redesign. I haven't tested either of these beliefs.
Beta Was this translation helpful? Give feedback.
All reactions