wiki.webvm.net/ blog/ 20081112 released

Greetings from sunny Guildford,

We are happy to announce a new WebVM SDK release, which includes the following new features:

JIDL

The JIDL (pronounced “Jiddle”) tool creates OpenAjax API Metadata Specifications for given Java interfaces now. To create these descriptions from the example interfaces run:

java -jar jidl.jar test/ test.TestInterface test.TestInterface2

Afterwards you will have two XML files in:

test/test.TestInterface.xml
test/test.TestInterface2.xml

WebVM

WebVM has got a new feature to query properties such as the version information of WebVM. Imagine the following example code to query for some default WebVM properties using JavaScript:

var version     = webvm.getProperty("webvm.version");
var vendor      = webvm.getProperty("webvm.vendor");
var description = webvm.getProperty("webvm.description");

This new approach can also be used for querying native module properties. Imagine the simple native module as in the http://example.webvm.net/simple example:

var simpleVersion     = webvm.getProperty("simple.version");
var simpleVendor      = webvm.getProperty("simple.vendor");
var simpleDescription = webvm.getProperty("simple.description"):

We created a new example to demonstrate this property functionality which can be found at

http://example.webvm.net/info

webvm.h changes

Property support

In order to support the new property functionality in native modules, we changed the getProperty module function to be exported as a dynamic loadable symbol called WVMGetProperty. WebVM will load a native module by the supplied property prefix and call this WVMGetProperty function of the module to query for particular properties. The simple example in the SDK has been updated accordingly.

To upgrade your module you need to perform the following two steps:

  1. Replace the old getProperty implementation with something like the following function:

    const char *WVMGetProperty(const char /* [in]  */  *key) {
        if(!strcmp(key, "vendor")) {
            return "<YOUR COMPANY>";
        }
        else if(!strcmp(key, "copyright")) {
            return "<YOUR COPYRIGHT>";
        }
        else if(!strcmp(key, "version")) {
            return "<YOUR VERSION>";
        }
        else if(!strcmp(key, "description")) {
            return "<YOUR DESCRIPTION>";
        }
        return NULL;
    }
    
  2. On Windows extend the linker definition file as follows:

    LIBRARY simple.dll
    
    
    EXPORTS
        WVMAttach      @1
        WVMDetach      @2
        WVMGetProperty @3
    

JavaScript object referencing

If your native WebVM module is going to retrieve JavaScript objects as arguments which are used for calling back into JavaScript, you will need to increase/decrease reference counts to these objects explicitly. As an example imagine a native API function which takes a callback function:

api.doSomething(function() { alert('callback happened'); });

In order to re-use the provided argument multiple times or at a later point you need to call:

wvcf->refObject(instance, objectRef);

Once you’re done with such a JavaScript object reference, you need to call:

wvcf->derefObject(instance, objectRef);

in order to allow the JavaScript engine to garbage collect it.

New version numbering scheme

Beginning with today’s release we introduce a new versioning scheme which consists of two versions:

  1. The WebVM API version used in webvm.h has been increased to 0.4
  2. The WebVM SDK version of this release is 0.4.3259

We will increase the minor version number in any subsequent future release of the WebVM SDK.

As usual, we will extend the tutorial with more details about the new functionality.

You can re-use your WebVM SDK download URL from your mail inbox or re-register at sdk.webvm.net.