You need to declare Foo as a parameter on the sayHello() proc definition.
{.emit:"""
#include <iostream>
class Foo {
public:
int data;
Foo() {}
void sayHello(void) { std::cout << "Hello from cpp" << std::endl; }
};
void sayWorks(void) { std::cout << "This works" << std::endl; }
""".}
type
Foo* {.importcpp: "Foo".} = object
data: cint
proc sayHello(foo: Foo) {.importcpp: "#.sayHello()".}
proc sayWorks() {.importcpp: "sayWorks()".}
proc main() =
var f: Foo
f.data = 83
echo f.data
sayWorks()
f.sayHello()
main()
Ok, it's starting to become clearer. Also, in the above example I need to use either "#.sayHello()" or just "sayHello". I guess that's the new vs. old version of using importcpp (from the manual: "#.CppMethod(@)")?!
Thanks for the help!