Calling steve method from C++ code

Hi, is there any (easy) way to call a steve object method inside a C++ code?

I mean, something like:

int execute_method(brEval args[], brEval *target, void *i) {
	brInstance *i = BRINSTANCE(&args[0]);
	i->call_method("my_steve_method");

	return EC_OK;
}

(I think you get the idea =)

TIA.

brMethodCallByName and brMethodCallByNameWithArgs

Check out the functions brMethodCallByName and brMethodCallByNameWithArgs. I'm not certain they're properly exported for Windows plugins under 2.4, but they should be for the 2.5 betas (http://www.spiderland.org/breve_2.5b).

- jon

Example?

In the svn slBrevePluginAPI.h it's not exported AFAICS. There is only brMethodCallByNameWithArgs and it's commented. In the 2.5b it's exported in slBrevePluginAPI.h? Should I include any other header?

Do you have any simple (working) example of what I want to do?

Thanks for the help.

import site failed on breve 2.5b

I' ve installed breve 2.5b and get a python error saying it can't import the site package when executing breve :S

I need some clarification

I need some clarification here. What platform are you on, and did you install from source or from the latest builds? Was the error when you were trying to launch breve, or when you tried to run a simulation?

- jon

Clarification

I'm using breve CLI precompiled for windows. I'm running a simulation. I've done:
1) Uncompress breve in a directory
2) cd plugins\samples
3) make (using MinGW 5)
4) cd ..\..
5) bin\breve.exe plugins\samples\c++SampleDemo.tz
6) I get this error:


C:\Documents and Settings\luca\My Documents\Celdas\breve_2.5b1>bin\breve.exe "pl
ugins\samples\c++SampleDemo.tz"
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "", line 1, in ?
  File "lib/classes\breve.py", line 4, in ?
    import sys, os
ImportError: No module named os
cannot convert type "vector" to type "pointer"
Begin stack trace:
breve engine tack trace:
0) cSampleController (0A99ACB0) init (line 8 of "plugins\samples\c++SampleDemo.tz")
1) cppSamplePluginObject (0A9D0520) init (line 25 of "plugins\samples\c++SampleDemo.tz")
End stack trace:
error in assignment
... error in file "plugins\samples\c++SampleDemo.tz" at line 26
error creating instance of class cppSamplePluginObject
Begin stack trace:
breve engine tack trace:
0) cSampleController (0A99ACB0) init (line 8 of "plugins\samples\c++SampleDemo.tz")
End stack trace:

I can strongly recommend

I can strongly recommend using Bloodshed IDE for Breve plugin development. It automatically uses Cygwin's gcc compiler and does not need any further configuration (linking etc) for creating dlls (which can be really a pain).

temporary problems in the source

Ah, sorry, it looks like this was the result of some temporary problems in the source, which has since been fixed. I will make a new build of CLI for Windows soon to get this fixed. In the meantime, the fixed source is in SVN.

- jon

Comment viewing options

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