nickgillian / grt

gesture recognition toolkit
861 stars 284 forks source link

extern C wrapper for use in other languages #24

Open muja opened 9 years ago

muja commented 9 years ago

Hi, it would be awesome if GRT were usable in other languages and for that to happen, a C ABI wrapper is necessary.

Are there any plans regarding this?

Regards.

cyberluke commented 9 years ago

Hi, interesting. I'm using GRT in Java via OSC. But am experimenting with Node.js now. What other languages do you mean just for information :-) ?

muja commented 9 years ago

We're probably going to use C#, although Java/Scala were also considered.

cyberluke commented 9 years ago

Yeah, one possibility would be to use existing OSC (OpenSoundControl protocol) from GRT Processing demo. The advantage of this approach is that it uses network UDP communication protocol and therefore recognition engine can run on different machine than C# client GUI.

C ABI wrapper is for encapsulating classic C code in C++, right? GRT uses already C++, so you could just google how to run unmanaged C++ code from managed C# code: http://blogs.msdn.com/b/yingqin/archive/2013/03/13/integrate-native-c-project-with-managed-c-projects.aspx

http://stackoverflow.com/questions/2532907/combining-c-and-c-sharp

This way you could use GRT C++ pipeline demos and instead of building console exe application in Visual Studio, you will build a dll native library (C++). Then you can call methods and operations from this C++ code in your managed C# code using the links provided above :-)

Hope this helps...

nickgillian commented 9 years ago

All good suggestions! Another option is to use a wrapper generator (such as SWIG) to automatically generate wrappers for the GRT in other languages.

I've used SWIG to generate GRT wrappers in Python and Java, although I'm not sure if SWIG natively supports C#? Here is a great example of someone who has used SWIG to get the GRT working in Android:

http://hollyhook.de/wp/grt-for-android

muja commented 9 years ago

Thank you all for the awesome input. OSC is not an option because it should both run on the same device and the devices we're targeting don't support C++ apps so we'd have to wrap it at some point anyway. Also, there's more overhead.

I will definitely try SWIG. My original thought was that the extern "C" wrapper is supposed to be in this repository because that one can be reused. The wrappers in the consuming languages respectively have to be created individually of course. Here is an example how snappy does it. Since most languages are able to easily communicate with C but not with C++, it would be beneficial, wouldn't it?

hugoliv commented 9 years ago

Has anyone tested GRT on iOS, with Swift ?

nickgillian commented 9 years ago

I know one company that are using GRT on iOS, last time I talked with them they said it was 'very easy to get running on iOS and just required a few typedefs to get working'. I'll reach out to them again and see if they would be willing to share the setup process.

hugoliv commented 9 years ago

Great news to know that there is a way to do that. I look forward to learn more about the process. thanks.

nickgillian commented 9 years ago

You can find some info on using GRT with iOS here: http://www.nickgillian.com/forum/index.php?topic=201.0

hugoliv commented 9 years ago

Hello,

Thank you very much. But could you ask them if they use obj-c or Swift ?

Olivier.

Le 11 juil. 2015 à 16:47, nickgillian notifications@github.com a écrit :

You can find some info on using GRT with iOS here: http://www.nickgillian.com/forum/index.php?topic=201.0

— Reply to this email directly or view it on GitHub.

keeth commented 7 years ago

@nickgillian your forum site appears to be down. I'm also interested in running GRT on iOS. Thanks!

narner commented 7 years ago

I did a little bit of research into this - if anyone knows how to alter the Cmake file so the GRT dylib can be compiled on iOS devices, I'd be happy to make an example project / tutorial.

narner commented 6 years ago

I wrote some posts on using the GRT on iOS - here's a guide on adding it to an Xcode project, and here's a post showing how I used it in practice.

@keeth Hopefully this will help! Feel free to ping me if you end up using it at all / have any questions.

DarioLondon commented 6 years ago

Did anybody managed to make the GRT work with an ios App ? I could not thought :-(