Using Linux Static Library with JS-Ctypes

249 Views Asked by At

I have created a Static Library in Ubuntu 12.04 and want to use the Library using JS-Ctypes.

My JS code is :

try {  
    var libc = ctypes.open("/lib/i386-linux-gnu/libtestfn.a");  
    alert("JSCtype - after open1");
} 

Unfortunately the open fails and exception is thrown. Same code works for other System libraries like libc.so.6.

Any pointer to solve this issue.

Thanks in advance

1

There are 1 best solutions below

0
On

jsctypes internally uses dlopen() to load the library (on Unix), so only dynamic libraries can be loaded. Simply re-compile your code as a dynamic shared library and it will load just fine.