Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extern C wrapper for use in other languages #24

Open
muja opened this Issue Jun 17, 2015 · 14 comments

Comments

Projects
None yet
7 participants
@muja
Copy link

muja commented Jun 17, 2015

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

This comment has been minimized.

Copy link
Contributor

cyberluke commented Jun 18, 2015

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

This comment has been minimized.

Copy link
Author

muja commented Jun 18, 2015

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

@cyberluke

This comment has been minimized.

Copy link
Contributor

cyberluke commented Jun 18, 2015

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

This comment has been minimized.

Copy link
Owner

nickgillian commented Jun 19, 2015

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

This comment has been minimized.

Copy link
Author

muja commented Jun 20, 2015

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

This comment has been minimized.

Copy link

hugoliv commented Jul 10, 2015

Has anyone tested GRT on iOS, with Swift ?

@nickgillian

This comment has been minimized.

Copy link
Owner

nickgillian commented Jul 10, 2015

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

This comment has been minimized.

Copy link

hugoliv commented Jul 10, 2015

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

@nickgillian

This comment has been minimized.

Copy link
Owner

nickgillian commented Jul 11, 2015

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

@hugoliv

This comment has been minimized.

Copy link

hugoliv commented Jul 13, 2015

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

This comment has been minimized.

Copy link

keeth commented Apr 19, 2017

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

@narner

This comment has been minimized.

Copy link
Contributor

narner commented May 10, 2017

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

This comment has been minimized.

Copy link
Contributor

narner commented Oct 8, 2017

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

This comment has been minimized.

Copy link

DarioLondon commented Oct 26, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.