On 05/09/2017 at 13:50, xxxxxxxx wrote:
Issues linking to external libraries in R19
When I was testing initially with a build from R17 in R19 I was having crashes in the ucrt.dll, called from the vcruntime.dll. My crash occured simply when cloning a sculpt object, nothing to do with any of my own actual code.
In VS 2015 they changed the way the runtime works. They refactored out the c-runtime libraries.
https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx
This is most likely the cause of my crashes since I make use of some libraries that use stdlib. Again note that none of my code was called at all, just linking to old libraries was enough to cause the crashes.
So for R19 I now compile using VS 2015. I also have to link to ucrt.lib and vcruntime.lib.
Issues linking to external libraries in R19
When I was testing initially with a build from R17 in R19 I was having crashes in the ucrt.dll, called from the vcruntime.dll. My crash occured simply when cloning a sculpt object, nothing to do with any of my own actual code.
In VS 2015 they changed the way the runtime works. They refactored out the c-runtime libraries.
https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx
This is most likely the cause of my crashes since I make use of some libraries that use stdlib. Again note that none of my code was called at all, just linking to old libraries was enough to cause the crashes.
So for R19 I now compile using VS 2015. I also have to link to ucrt.lib and vcruntime.lib.
Dealing with Reflection Layers
I have also been working on support for dealing with Reflection Layers. In R18 the API was changed for ReflectionLayer which means that R17 plugins will no longer run in R18 onwards. They removed the "flags and name" parameters from the SDK and replaced it with functions. This means that if you run your plugins in R18 (or R19) it will lock up or crash since it will no longer be able to get to the data and will point somewhere randomly in memory.
The end result for me
So now I have gone from only having to compile 1 version on OSX and 1 version on Windows to having to compile 3 versions on OSX and 3 versions on Windows.
So for me the forward compatibilty of Cinema 4D development is completely gone. From now on I am forced to build a separate version for each C4D version on each OS. But I am perfectly happy to do this, and should have done this from the beginning.
So its finally time for me to setup a proper automated build process.
For everyone one else
If you decide to start using Reflection Layers you will need to at least build separately for R17 and R18, on both OS's.
If you link to external libraries you will also need to build them separately for R19 due to the changes in VS 2015 (this is not C4D's fault).
If you don't use Reflection Layers and don't use any external libraries then versions compiled in R17 should work fine in R18, R19. At least the C4D SDK Examples work fine in all of my testing. But for me this is no longer an option so I will be compiling for every new version from here on out.
My Opinion
Even though its nice to have this forwards compatibility with future versions of C4D, I do believe compiling against the latest C4D SDK is always best. So I would recommend all developers to build fresh for each OS for each new version of C4D if you are using C++. I am perfectly happy to do this from now on. The added benefit is that I can now add in features for each specific version when C4D adds new features to the SDK. And in doing so it ensures that nothing has changed (or been removed) in the SDK that will break my plugins (ie ReflectionLayer SDK changes).
The way around all of this is to just use Python. So if you don't need to access external libraries, don't require anything computationaly expensive, then Python is a much better solution.