Building develop for C++ API
-
Hi @Christoph-Hart and all,
following your advice here (updating streaming_example) I setup a fresh JUCE 6 project and added the necessary modules.
Without adding any own code and not even at the point to call the factory it doesn't compile. The reason seems to be internal changes, that many containers use nowReferenceCountedObject<>::Ptr
(which is great I think).
But the accessor functions return raw pointers, like seen here:
There are two ways to fix it, either we return a Ptr or add
.get()
to each return statement. A warning, they are many!I would volunteer to go through the code and fix those making it compile, if you will integrate those changes upstream (I don't intend to maintain a fork).
Which way do you want me to fix it?
My advice would be adding
using Ptr = ReferenceCountedObjectPtr<ActionBase>;
and return an ActionBase::Ptr instead.Thanks,
Daniel -
Sorry @daniel I've overlooked this thread.
You can temporarily disable
JUCE_STRICT_REFCOUNTER
preprocessor from thejuce_core
module in order to proceed (it's disabled by default in all HISE projects, but you might have it enabled in your project).I'll be crawling through the codebase and try to make it compile with the flag enabled. It's a boring task, but sometimes I find other weird stuff lurking around when doing one of these tasks.
-
@christoph-hart no worries, thanks for answering.
Switching off the strict ref counter check indeed is a suitable workaround. I was using the defaults in my Projucer project.It gets me a lot further. Now I am stuck with the ModulatorChain.
Seems you have some trick to create the Modulators from a template, I have no idea how that is working. I did find the `XyzModulatorFactoryType::fillTypeNameList()``` methods but have no idea if or where to call them. They are not static. I guess there is some entry point that sets up all that properly.Thanks again,
Daniel -
FYI I went through the codebase today and fixed compilation with the flag, but I haven't pushed it yet. It was only about 1200 compilation errors, so that was easy :)
Check the
raw::Builder
class for setting up your module tree:https://docs.hise.audio/cpp_api/raw/classhise_1_1raw_1_1_builder.html
A real world example can be found here:
https://github.com/christophhart/vcsl_hise/blob/master/AdditionalSourceCode/Raw.cpp
-
@christoph-hart said in Building develop for C++ API:
FYI I went through the codebase today and fixed compilation with the flag, but I haven't pushed it yet. It was only about 1200 compilation errors, so that was easy :)
Oh wow, that's awesome! Thank you so much for that, looking forward to the update. I didn't dare to hope!
I'm curious which way you fixed it :-)And thanks for the pointers, I will read into that.
-
@daniel said in Building develop for C++ API:
I'm curious which way you fixed it
I would estimate I've added
.get()
in 90% of all cases and only returned / passed a ref counted pointer where the caller & callee actually takes / shares the ownership.