How to return a brList structure?

I want to return a List from my plugin to breve. The sample codes only show how to access a list parameter, I would love it to read a code snippet showing how to create a listm passing some integers into it and returning it.

How to return a brList structure?

The quick answer is to create a new brEvalListHead, and then make multiple calls to:

int brEvalListInsert( brEvalListHead *head, int index, brEval *value );

So off the top of my head...

brEval myInt;

myInt->set( 1.0 );

brEvalListHead *list = new brEvalListHead();

brEvalListInsert( list, &myInt );

- jon

How to return a brList structure?

Thx for the quick answers Jon. But I still have a bunch of problems which converge in this topic so I will post them all here.

1. I used the following code with the plugin library included in breve 2.5d1:

brEvalListHead* list = new brEvalListHead();
brEval token;
...
token.set(actToken);
...
brEvalListInsert(&list, i++, &token);

But then I get a linker error:
[Linker error] undefined reference to `brEvalListHead::brEvalListHead()'
I took a look into the slBrevePluginAPI.h where the constructor is regulary declared. My only explanation is that its definition is not found in the library file.

2. I noticed that brEvalListHead is like most other datatypes a class. In your tutorial you show how to write pure C plugins. Is it possible to write plugins using a pure C compiler?

This question is getting

This question is getting important to me, so perhaps I should clear it a bit.
A call to the constructor of:
[code]
brEvalListHead *listHead = new brEvalListHead();
[/code]
raises me a linker error:
[code]
[Linker error] undefined reference to `brEvalListHead::brEvalListHead()'
[/code]

Within the slBrevePluginAPI.h the constructor is declared. But it seems that it is not implemented within the
'brevePlugin.a'. Other plugins compile without problem so I am quite sure to link successfully against the library. Any idea?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.