Permalink
Browse files

use `bindings` package to load binary

fixes #144
  • Loading branch information...
1 parent 4f7255d commit a802562d3e4a6794bbe635851ea33e4200ffa213 @defunctzombie defunctzombie committed Jul 26, 2012
Showing with 4 additions and 7 deletions.
  1. +1 −7 lib/bindings.js
  2. +3 −0 package.json
View
@@ -1,7 +1 @@
-try {
- // node 0.6+
- module.exports = require('../build/Release/libxmljs');
-} catch (e) {
- // node 0.4.x
- module.exports = require('../build/default/libxmljs');
-}
+module.exports = require('bindings')('libxmljs');
View
@@ -16,6 +16,9 @@
}
, "main" : "./index"
, "engines" : { "node" : ">=0.4.7" }
+, "dependencies": {
+ "bindings": "1.0.0"
+ }
, "devDependencies":
{
"nodeunit": "*"

3 comments on commit a802562

#144 issue still shows with this patch:

└─┬ libxmljs@0.6.1
└── bindings@1.0.0
node@v0.9.3
npm@1.1.64
Ubuntu@11.04

require('libxmljs')
Error: Symbol libxmljs_module not found.
at Object.Module._extensions..node (module.js:490:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at bindings (/home/meego/app-checker/tizen-app-checker/web/node_modules/libxmljs/node_modules/bindings/bindings.js:74:15)
at Object. (/home/meego/app-checker/tizen-app-checker/web/node_modules/libxmljs/lib/bindings.js:1:99)
at Module._compile (module.js:454:26)
at Object.Module._extensions..js (module.js:472:10)
at Module.load (module.js:356:32)

Collaborator

defunctzombie replied Oct 29, 2012

You have to build the library first. The bindings module just allows us to avoid some basic code duplication, it doesn't build the module for you.

Also, you are using an unstable version of node. While I don't discourage this, I will say that its behavior may change between now and when it is released and therefore some things that may seem broken now won't be. I would suggest checking out the bindings module to make sure it is still reporting the right errors on 0.9.

Please sign in to comment.