SKK
SKK

Reputation: 1719

Play Scala - Native access

I am developing an web application using the Play framework in Scala language. In my application I have to access the native methods which is written in C++ and converted into .so by using swig.

My aim is to call the native method which is in .so file from the Controller class. I have searched in the internet, but I didn't get any documentation for this.

I have seen some links which is used by scala language.

https://code.google.com/p/scala-native-access/ https://code.google.com/p/bridj/wiki/Download#Specialized_subsets_(smaller_JARs_!) https://github.com/xudongyang/scala-native-access

But they didn't mention how exactly use this in the Play framework.

Can anybody have the documentation for Play scala native access? Can anybody have the sample applcation for the same?

Upvotes: 1

Views: 315

Answers (2)

andyczerwonka
andyczerwonka

Reputation: 4260

Like in any JVM language, JNA/JNI gives you native access. Be aware that because of Play's use of class loaders, you'll need to make sure you access from the same class. See fail to load a native library using activator (Play Framework)

Upvotes: 2

tryx
tryx

Reputation: 995

This is hard to answer in general. Play! is just a Scala library and framework, some any tool that allows you to use native calls in Scala will work similarly with play. From the first link that you pointed to, there are instructions to integrate with SBT (the Scala Build Tool) which also manages your Play framework. You will need to make the changes they mention to your build.sbt file which you can find in the top level of your Play project folder.

Upvotes: 1

Related Questions