felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart McCulloch <mccu...@gmail.com>
Subject Re: Bundle-NativeCode in Felix framework
Date Wed, 19 Aug 2009 08:40:52 GMT
2009/8/19 geelpheels <geelpheels@sina.com>

> After browsing the source code of felix, there's one point I cannot
> understand.
> OSGi r4 supports loading native libraries, even the MANIFEST.MF has an
> option:Bundle-NativeCode.
> But in the felix framework project's source code, I cannot find any code
> about automatically loading the native library using this
> "Bundle-NativeCode" option.
> Is this a bug of felix framework or just my misunderstanding of OSGi r4?
> Can anyone tell me?

the native libraries aren't automatically loaded when the bundle starts -
instead it's done on-demand
when a Java class uses System.loadLibrary(), typically inside a static
initialization block in the class

this then calls findLibrary() on the classloader that loaded the class, like
Felix's ModuleClassLoader:


which is a custom classloader whose "findLibrary" method delegates to the
respective native library
in the bundle cache according to the bundle involved, the OS, and the
Bundle-NativeCode headers


> View this message in context:
> http://www.nabble.com/Bundle-NativeCode-in-Felix-framework-tp25039905p25039905.html
> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.

Cheers, Stuart

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message