I wanted to know this too, so I did a bit of poking. There's a sample buried in testSqPlus2.cpp of how to do it at about line 1027. Here's my simplified version:
//Script.nut file
function MyFunc( vec ) {
print("X: " + vec.x + ", Y: " + vec.y + ", Z: " + vec.z);
return vec.x > vec.y;
}
//CPP file
Vector3 v(9.0f, 3.0f, 4.0f);
SquirrelObject script = SquirrelVM::CompileScript(_T("Script.nut"));
SquirrelVM::RunScript(script);
bool result = SquirrelFunction<bool>(_T("MyFunc"))(v);
cout << "Result = " << result << endl;
Note that you have to Run the script before you can retrieve the function. There may be a way around that, but I don't know it yet. Just don't put any code outside of a function and you'll be fine.
Alos, for the sake of clarity: the template argument of SquirrelFunction is the return type you expect back. void is perfectly acceptable here.
That clear it up?