Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
AverageCoder
Posts: 21
Registered: ‎05-04-2012
My Device: Playbook

Calling funtions in .SO Libraries in ANE Project

Hey guys, Really need help here. Ive compiled an Unrar Commandline to Playbook and it works brilliantly. What Im trying to do now is include the generated .so file in the ANE Example (http://supportforums.blackberry.com/t5/Adobe-AIR-Development/Creating-AIR-Native-Extensions-for-BB10... so that I am able to use the library in Actionscript. The Function  RAROpenArchiveEx seems to work but I am unable to create a RAROpenArchiveDataEx struct. What am I doing wrong? Ive only ever used libs and dll so this is new to me. ANY HELP WOULD REALLY BE APRICIATED! Ive included the library.

Please use plain text.
Contributor
jamespaulmuir
Posts: 33
Registered: ‎04-26-2010
My Device: Z10 / PlayBook 16GB

Re: Calling funtions in .SO Libraries in ANE Project

[ Edited ]

Where in the process are you exactly?

 

Let me make some assumptions so that I can understand better

 

You have created the ANE project, right-click project -> configure -> add library -> add your .so 

 

Created your methods (that your actionscript will call, but under the hood will call your unrar library) and exposed them through ContextInitializer

 

Then, build the ANE and exported it to an ANE file

 

Created the ActionScript library, added the Native Extension to the project, written the methods that call the exposed methods from the ANE

 

and then while trying to call an exposed method, under the hood (inside an ANE method) you are calling RAROpenArchiveEx, which is working, but creating a RAROpenArchiveDataEx struct is failing.

 

Is this correct?

Please use plain text.
New Developer
AverageCoder
Posts: 21
Registered: ‎05-04-2012
My Device: Playbook

Re: Calling funtions in .SO Libraries in ANE Project

ive gotten up the created methods for actionscript to call and tested the hello world method, but once I add the unrar library, I get errors because the structs arent defined. Ive included a screenshot

Please use plain text.
Contributor
jamespaulmuir
Posts: 33
Registered: ‎04-26-2010
My Device: Z10 / PlayBook 16GB

Re: Calling funtions in .SO Libraries in ANE Project

Oh ok it looks like you will need to add the directory that includes the unrar header files to your "includes" for the ANE project.

 

and then you should be able to include the appropriate header files in your main.c for whatever code you need

Please use plain text.
New Developer
AverageCoder
Posts: 21
Registered: ‎05-04-2012
My Device: Playbook

Re: Calling funtions in .SO Libraries in ANE Project

Well that was a definate step in the right deirection, now theres a new problem with the header, seems like QNX doesnt like alot of the variable types in it (HEADER, PASCAL eg), any clue to why? ive included the header if you wanna take a look.

Please use plain text.
Contributor
jamespaulmuir
Posts: 33
Registered: ‎04-26-2010
My Device: Z10 / PlayBook 16GB

Re: Calling funtions in .SO Libraries in ANE Project

It looks like the define _UNIX is defined in raros.hpp, so be sure to include raros.hpp before dll.hpp

 

#include"raros.hpp"
#include"dll.hpp"

 

That should at least allow the project to build.  

 

Then you should be able to start using the code like this (at least I think):

 

struct RARHeaderData *header;

 

Please use plain text.
New Developer
AverageCoder
Posts: 21
Registered: ‎05-04-2012
My Device: Playbook

Re: Calling funtions in .SO Libraries in ANE Project

BRILLIANT!!! NOW ITS WORKING!! THANKS SO MUCH JAMES!

Please use plain text.
New Developer
AverageCoder
Posts: 21
Registered: ‎05-04-2012
My Device: Playbook

Re: Calling funtions in .SO Libraries in ANE Project

new problem:smileysad:

ANE wasnt actually doing anything even though it compiled and seemed to work, so i put the code into a qne c++ project and everything seems look alright, but when im building i get an error of

"C:\Users\Andrew\NDKProjects\HelloWorldConsole\src/libunrar.so: undefined reference to `RecVolumes::~RecVolumes()'
C:\Users\Andrew\NDKProjects\HelloWorldConsole\src/libunrar.so: undefined reference to `RecVolumes::Restore(RAROptions*, char const*, wchar_t const*, bool)'
C:\Users\Andrew\NDKProjects\HelloWorldConsole\src/libunrar.so: undefined reference to `RecVolumes::RecVolumes()'
cc: C:/bbndk-2.0.1/host/win32/x86/usr/bin/ntoarm-ld caught signal 1"

 

anymore help would be greatly appriciated

 

Please use plain text.
Developer
canurabus
Posts: 23
Registered: ‎05-29-2012
My Device: PlayBook

Re: Calling funtions in .SO Libraries in ANE Project

Have you linked against the unrar shared library you built? You included the header files -- now you gotta link your app to libunrar.so.

Please use plain text.
New Developer
AverageCoder
Posts: 21
Registered: ‎05-04-2012
My Device: Playbook

Re: Calling funtions in .SO Libraries in ANE Project

you mean by including the library in the projects properties?

Please use plain text.