PDA

View Full Version : Minimal example of module class



Petr Schreiber
03-07-2011, 11:46
As the ThinBASIC 1.8.8.0 introduced the module class concept, and some users start to experiment with it, I attach here very simple example of module exposing class.


The PowerBASIC module code, contained in thinBasic_Vector3D.bas, defines the Vector3D class with constructor, destructor and single "normal" method, called ToString
The ThinBASIC test code, represented by thinBasic_Vector3D_Test.tBasic, shows how to instantiate and use the created object

It is very simple project just to demonstrate few important steps in module class creation:

creating internal COM representation
creating visible interface to it via thinBasic_Class* SDK functions
creating wrapper functions/subs for methods, taking care of instantiation, release and parameter parsing (same as in normal modules)


Petr

maxim
03-07-2011, 13:11
Thanks Petr.
Can you do MSVC same or other minimal example for module class? Perhaps FreeBASIC?

Petr Schreiber
03-07-2011, 14:13
Hi Maxim,

I am sadly not familiar with C or FreeBASIC approach to create COM classes, maybe other guys will know better.
I know that you can create classic modules (without classes) quite easily with FB, C (as seen in ThinBASIC/SDK samples), but the classes are new thing to the SDK, so no examples are present at the moment.


Petr

maxim
07-07-2011, 07:25
Thanks Petr.
One of the guys you advise?