Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

REALRegisterModule problem (Real Studio Plugins Mailinglist archive)

Back to the thread list
Previous thread: Loading system Object on 2008r2
Next thread: Can't compile for Linux anymore :(:(:(


macosx and unix paths   -   GOLD
  REALRegisterModule problem   -   Bob Delaney
   Re: REALRegisterModule problem   -   Christian Schmitz
    Re: REALRegisterModule problem   -   Bob Delaney

REALRegisterModule problem
Date: 20.05.08 07:04 (Tue, 20 May 2008 01:04:28 -0500)
From: Bob Delaney
I wanted to test passing an array of doubles from a REALbasic
application to a plugin which would then modify the values in that
array for the application.

My G4 iMac has OS X 10.5.2. I used Xcode 3.0 with the latest SDK
plugin files from RB 2008 Release 2 to make the plugin. I've read that
it's better to use REALRegisterModule rather than REALRegisterMethod,
so I used the example "Complete Module" from the SDK to code the
interface file as:

_____
/* testArray.cpp */

#if WIN32
#include "WinHeader++.h"
#endif

#include "rb_plugin.h"

static void modifyArray(REALarray arr);

static REALmethodDefinition TestArrayMethods[] = {
{ (REALproc)modifyArray, REALnoImplementation, "modifyArray(arr As
REALarray)" },
};

REALmoduleDefinition TestArrayDefinition = {

kCurrentREALControlVersion,

// This field specifies the name of the class which will be
// exposed to the user
"TestArray",

// Methods
TestArrayMethods,
sizeof( TestArrayMethods ) / sizeof( REALmethodDefinition ),

// Constants
nil,
0,

// Properties
nil,
0,
};

static void modifyArray(REALarray arr)
{
int i, n;
double value;

n = REALGetArrayUBound(arr);

for(ii {
REALGetArrayValue(arr, i, &value);
REALSetArrayValue(arr, i, 2*value);
}

}/* modifyArray */

void PluginEntry()
{

// Register our module
REALRegisterModule( &TestArrayDefinition );

}
_____

The plugin "testArray.dylib" compiled with no problems. I put that
into REALbasic's Plugins folder. Then I created an RB project with a
Pushbutton and a Multi-line EditField. The Pushbutton script is:

dim arr(6) As Double
dim i As Integer
dim myString As String
for ito 5
arr(i)=i
next
TestArray.modifyArray(arr)
myString=""
for ito 5
myString = myString + val(arr(i)) + EndOfLine
next
EditField1.text = myString

Note that for the line after the first "next" typing "Tes" caused
"TestArray" to appear. And then typing "." caused "modifyArray" to
appear. Since my REALmoduleDefinition did define the class name as
"TestArray", and my method is named "modifyArray", all seemed well.

But when I clicked on the "Run" button I got an error window saying:
_____
An error occurred while compiling this project.

Message: There is no class with this name.

File: testArray.dylib

Location: TestArray.modifyArray
_____

What am I doing wrong? I note that I was able to compile and use the
"Complete Module" plugin without having this problem.

Thanks for your help.
Bob

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

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

Re: REALRegisterModule problem
Date: 20.05.08 12:15 (Tue, 20 May 2008 13:15:51 +0200)
From: Christian Schmitz
Bob Delaney <<email address removed>> wrote:

> { (REALproc)modifyArray, REALnoImplementation, "modifyArray(arr As
> REALarray)" },

> What am I doing wrong? I note that I was able to compile and use the
> "Complete Module" plugin without having this problem.

Your method declaration has a class which does not exist: REALarray

Gruß
Christian

-

Re: REALRegisterModule problem
Date: 20.05.08 13:51 (Tue, 20 May 2008 07:51:52 -0500)
From: Bob Delaney

On May 20, 2008, at 6:15 AM, Christian Schmitz wrote:

> Your method declaration has a class which does not exist: REALarray

Thanks! REALarray exists in C, not in REALbasic. I changed that line to:

{ (REALproc)modifyArray, REALnoImplementation, "modifyArray(arr() As
Double)" },

and I found another mistake where I used val(arr(i)) instead of
str(arr(i)). Now everything works fine.

Bob

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

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