Just wondering : What is the difference between 'constructor' and 'create' procedures ? Is 'create' really necessary ?
Another question : The destructor seems to be never called. It should be just before the 'destroy' function, shouldn't it ?
Construction & creation
-
martignasse
- Site Admin
- Posts: 611
- Location: Lyon, FRANCE
- Contact:
hi LevraiBernardo,
Those two pair of functions work together at different levels :
Create and Destroy are two function exposed by our module (litteraly exposed by the dll).
Like that, Usine can call these functions when you create and destroy the module in the patch view.
constructor and destructor are the first and last life step of the class who represent the module, it's where we can make memory allocation/deallocation or variable initialization for the class members.
Thus, constructor should be invoked in the create function, and destructor in the destroy function, like in the examples provided.
This is the easiest way to make a generic communication interface beetwen modules and usine, at least for know.
Remember there is two kind of functions in the SDK :
- Globals functions exposed by the dll (those with DLL_EXPORT at the and of the UserDefinition.h file)
- The module class and these member functions, those are not known by usine.
additionally, we store some convenient pointers in the module :
- some TEVT who are provided by usine thru the SetEventAdress function, they are important because whe need them to access and manipulate the data of each connexion.
- the TMasterInfo provided the first time by usine thru the InitModule function, it contain essentially the pointer list of functions inside usine we can use, they are wrapped for direct acces by the TUserModule base class you should derive from for you'r module.
Hope it help you to understand the SDK architecture.
PS : those what good questions, as they help me to populate the WIKI
Those two pair of functions work together at different levels :
Create and Destroy are two function exposed by our module (litteraly exposed by the dll).
Like that, Usine can call these functions when you create and destroy the module in the patch view.
constructor and destructor are the first and last life step of the class who represent the module, it's where we can make memory allocation/deallocation or variable initialization for the class members.
Thus, constructor should be invoked in the create function, and destructor in the destroy function, like in the examples provided.
This is the easiest way to make a generic communication interface beetwen modules and usine, at least for know.
Remember there is two kind of functions in the SDK :
- Globals functions exposed by the dll (those with DLL_EXPORT at the and of the UserDefinition.h file)
- The module class and these member functions, those are not known by usine.
additionally, we store some convenient pointers in the module :
- some TEVT who are provided by usine thru the SetEventAdress function, they are important because whe need them to access and manipulate the data of each connexion.
- the TMasterInfo provided the first time by usine thru the InitModule function, it contain essentially the pointer list of functions inside usine we can use, they are wrapped for direct acces by the TUserModule base class you should derive from for you'r module.
Hope it help you to understand the SDK architecture.
PS : those what good questions, as they help me to populate the WIKI
Martin FLEURENT - Usine Developer - SDK maintainer
Who is online
Users browsing this forum: No registered users and 36 guests
