2. RB Class method found, constructor question (Wade Maxfield)

Subject: RB Class method found, constructor question
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

After some feedback, I found a class registration method (in glue and in
examples (TestPlugin))

However, I don't know what they want in the "initializer"/"deinitializer" field of the class registration structure, since there are no examples.

MyClass::MyClass() {foo(); etc...} is my constructor, I assume that is
what is meant by an "initializer."

Since the class isn't instantiated, how do I fill in the field that the TestPlugin() has listed as NULL for the "initializer", er "constructor" ?

The problem of compiling for Linux... is a separate problem than how to write a class.

I suggest you approach each problem separately. Use the class examples on the Mac. And once you know what to do, copy/paste those examples into the Linux project.

Also, it's probably a bad idea to mix C++ classes with RB classes. You should write in C mode. That is, no C++ constructors for your actual class. Although an RB class can make use of C++ classes if they are created with new and delete and stored as properties of the RB class.

Here's some of my "init/deinit" code.

void ED_St_Constructor( OPObject self ) {
        FuzzySettings* fz = GetSettingsData(self);

        fz->GapStartCost = 1;
        fz->GapStretchCost = 1;
        fz->Mode = kFuzzLevenshtein;
        fz->self = self;
        fz->MaxDepth = 1024;

        FillDistances_( fz, false );

        fzsSanity_( fz, false );
}


void ED_St_Destroy( OPObject self ) {
        FuzzySettings* fz = GetSettingsData(self);
        fzsSanity_( fz, true );
        SentiFree( fz->Distances );
        fz->Distances = 0;
        OPClearRef( fz->Dictionary );
}

Unfortunately it uses totally different conventions :) OPObject is just a REALobject, and I don't use the standard Object to struct function, instead I write my own.

But you get the point, it's much the same as a normal method.

You don't NEED a init or deinit method because of RB itself. It's just there if your plugin happens to need it, but RB doesn't force that need on you.



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to