I hope this is the correct forum, so if not please forgive.
I am just trying to get simple interaction between C++ code and Brook+ generated functions. Say I have a C++ file with the "main()" function and within that function it will call a function that was generated by the Brook+ compiler. How can I do this? I am interested in embedding kernel operations INSIDE of standard C++ code - if possible.
e.g.,
Brook-generated file: "brook.cpp" contains function "void test()" that will printf "hello world". Standard C++ file main() will call test
I know this is probably a very simple problem but I am new. Thanks.
Hi,
Let me give an example of how I do it as it is probably easiest to explain for me.
Assume we have a brook file called kernels.br. Here is your function kernel void test. After compiling, it will generate the usual files.
Let's say your main function is in main.cpp, make sure you've included kernels.h. (or whatever header file brcc generates) You should be able to use void test inside your main function. However, you stil need to compile kernels.cpp, so make sure you add that to your project as well.
Hope this helps Good luck and have fun!
lasagna,
Thank you for the reply. I will give your suggestions a try and see what happens.
I will definately try and have fun with it
Thank you.
However, I have another related question. How can you build a class in C++ to interact with the Brook+ generated files? Is there a simple code examples somewhere?
You can take a look at any sample under samples\CPP folder in Brook+ installation directory