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
Contributor
IamSergio
Posts: 18
Registered: ‎07-05-2012
My Device: PlayBook
My Carrier: None

How to export ANE project (.SO file) to .ANE file?

Hi, all.

I've created ANE-project. HalloWorld, for example. It's builded .SO file. How to export to .ANE file?

I've selected in Main Menu of QNX Momentics IDE File->Export->BlackBerry Tablet OS->AIR Native Extension...

Question one:
What should I write to the fields in AIR Components group box?

Question two:
I want to use some features of NativeSDK (the existing ANSI C src) in Adobe AIR application for playbook. For it's purpose I'm trying to use the ANE project. I'm on the right track?

P.S.: Sorry, for the stupid question and bad my English. I'm just learning to developing for BlackBarry.

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to export ANE project (.SO file) to .ANE file?

There are 2 fields that have to be setup when exporting the ANE. Where is the AIR SDK and where is the SWC for the AS3 library associated with the ANE. Just browse to both of those. You only have to do this once (new ANE will need a new SWC path).

Yes you are on the right track.
Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: How to export ANE project (.SO file) to .ANE file?

There is an excellent step-by-step guide to creating ANE's for PlayBook and BB10:

 

http://supportforums.blackberry.com/t5/Adobe-AIR-Development/Creating-AIR-Native-Extensions-for-BB10...

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Contributor
IamSergio
Posts: 18
Registered: ‎07-05-2012
My Device: PlayBook
My Carrier: None

Re: How to export ANE project (.SO file) to .ANE file?

Thanks!

I've done all the steps on the link...

At now the new problem here: debugger says:

ArgumentError: Error #3500: The extension context does not have a method with the name sayHello.
    at flash.external::ExtensionContext/_call()
    at flash.external::ExtensionContext/call()
    at com.example::NativeAS3/sayHello()[D:\dsn\AIR\nativeAS3\src\com\example\NativeAS3.as:16]
    at MainSubWindow/GOTestOnClick()[D:\dsn\AIR\RDesktop\src\MainSubWindow.as:146]

My googling is not to fix bug...

I've trying export to release and run...
I've trying call ...this._ctx.call("sayHello", null) instead of ...this._ctx.call("sayHello") ...

I've used Win_7, NDK_2 and FlashBuilder 4.7

Help me, please :Helpsmilie:

Please use plain text.
Contributor
IamSergio
Posts: 18
Registered: ‎07-05-2012
My Device: PlayBook
My Carrier: None

Re: How to export ANE project (.SO file) to .ANE file?

Sorry, FlashBuilder 4.6

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: How to export ANE project (.SO file) to .ANE file?

Check your contextInitializer function (on the native side) and make sure you've added sayHello to functionNames and functionPtrs.

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Contributor
IamSergio
Posts: 18
Registered: ‎07-05-2012
My Device: PlayBook
My Carrier: None

Re: How to export ANE project (.SO file) to .ANE file?

sayHello is added to functionNames and functionPtrs

 

My contextInitializer is copy/paste from example:

 

void contextInitializer(void* extData, const uint8_t* ctxType,
        FREContext ctx, uint32_t* numFunctionsToSet,
        const FRENamedFunction** functionsToSet) {
    fprintf(stdout, "[nativecode.c] - SampleContextInitializer Begins\n");
    fflush(stdout);

    const char *functionNames[] = { "sayHello", NULL };
    FREFunction functionPtrs[] = { sayHello, NULL };

    // count number of functions
    *numFunctionsToSet = 0;
    while (functionPtrs[*numFunctionsToSet] != NULL) {
        (*numFunctionsToSet)++;
    }

    FRENamedFunction *functionSet= calloc (*numFunctionsToSet, sizeof(FRENamedFunction));
    char *temp = NULL;
    int i;
    for (i = 0; i < *numFunctionsToSet; i++) {
        int bufferSize = sizeof(char) * (strlen(functionNames[i]) + 1);
        temp = (char*) malloc(bufferSize);
        strncpy(temp, functionNames[i], bufferSize);
        temp[strlen(functionNames[i])] = '\0';
        functionSet[i].name = (uint8_t*) temp;
        functionSet[i].functionData = NULL;
        functionSet[i].function = functionPtrs[i];
    }
    *functionsToSet = functionSet;
    fprintf(stdout, "[nativecode.c] - SampleContextInitializer Ends\n");
    fflush(stdout);
}

Please use plain text.
Contributor
IamSergio
Posts: 18
Registered: ‎07-05-2012
My Device: PlayBook
My Carrier: None

Re: How to export ANE project (.SO file) to .ANE file?

I've tested it on Playbook and Simulator - the result is same.

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to export ANE project (.SO file) to .ANE file?

The 3500 error has to do because the "bps" library is not linked in with your app.  You have to do this for "[All Configuration]" or you will get the same error depending on your deployment.  This has changed in the latest build of the IDE (thanks to RIM who helped find this out).

 

C/C++ Build / Settings

Configuration: [All configurations]

Select QCC Linker / Libraries.  Under Libraries (-l) "add" "bps"

 

ane.png 

Please use plain text.