Skip to content

Commit

Permalink
use bindings package to load binary
Browse files Browse the repository at this point in the history
fixes #144
  • Loading branch information
defunctzombie committed Jul 26, 2012
1 parent 4f7255d commit a802562
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 1 addition & 7 deletions lib/bindings.js
@@ -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');
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -16,6 +16,9 @@
}
, "main" : "./index"
, "engines" : { "node" : ">=0.4.7" }
, "dependencies": {
"bindings": "1.0.0"
}
, "devDependencies":
{
"nodeunit": "*"
Expand Down

3 comments on commit a802562

@DonnaWuDongxia
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#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

@DonnaWuDongxia
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@defunctzombie
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.