jamoma / JamomaCore

Jamoma Frameworks for Audio and Control Structure
Other
36 stars 14 forks source link

Extension Loading code: conform to Jamoma naming conventions / practices #335

Open tap opened 9 years ago

tap commented 9 years ago

From #333 code review:

There is code here which does not follow the usual Jamoma naming conventions. This not really the fault of anyone as we haven't really published anything about this -- and we have other places in the code that are less-than-rigorous about this.

The concern here is that it makes it slightly hard to understand what is going on if we start having diverging styles throughout the code. Some style really doesn't matter and is a preference (where to put { and } for example). But the names of functions/templates/classes should try to adhere our conventions.

For example: OperatingSystem should be TTOperatingSystem. This way we know immediately that this is something we've defined in Jamoma and it is not something we're pulling in from some library.

My apologies if this seems tedious, but things like this can bite us down the road if we don't pay attention to it now!

Similarly, loadClass() would benefit from name consideration. One thing to consider is that loading an extension is not the same as loading a class -- an extension may (and often does) contain many many classes.

jcelerier commented 9 years ago

I changed the names accordingly in 6899548a.

One thing I am left wondering about is the loading of classes in the case of a static build. Is it as simple as linking statically and calling either TTLoadJamomaExtension_theExtension or more directly theClass::registerClass(); from the statically built application ?

tap commented 9 years ago

It is the former. As an example see this source: https://github.com/tap/TapTools/blob/master/source/tap.zerox~/tap.zerox~.cpp

The AnalysisLib is linked statically and on line 29 the call to initialize the lib is prototyped:

extern "C" TTErr TTLoadJamomaExtension_AnalysisLib(void);

Then on line 44, Jamoma is initialized, followed by the lib:

TTDSPInit();

TTLoadJamomaExtension_AnalysisLib();

Having done this, the Max extern is able to use the "zerocross" class.