{"action":"created","issue":{"url":"https://api.github.com/repos/node-ffi/node-ffi/issues/208","labels_url":"https://api.github.com/repos/node-ffi/node-ffi/issues/208/labels{/name}","comments_url":"https://api.github.com/repos/node-ffi/node-ffi/issues/208/comments","events_url":"https://api.github.com/repos/node-ffi/node-ffi/issues/208/events","html_url":"https://github.com/node-ffi/node-ffi/issues/208","id":84630509,"number":208,"title":"Can't run node-ffi example on Windows 7 or XP","user":{"login":"danielyaa5","id":6629098,"avatar_url":"https://avatars.githubusercontent.com/u/6629098?v=3","gravatar_id":"","url":"https://api.github.com/users/danielyaa5","html_url":"https://github.com/danielyaa5","followers_url":"https://api.github.com/users/danielyaa5/followers","following_url":"https://api.github.com/users/danielyaa5/following{/other_user}","gists_url":"https://api.github.com/users/danielyaa5/gists{/gist_id}","starred_url":"https://api.github.com/users/danielyaa5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielyaa5/subscriptions","organizations_url":"https://api.github.com/users/danielyaa5/orgs","repos_url":"https://api.github.com/users/danielyaa5/repos","events_url":"https://api.github.com/users/danielyaa5/events{/privacy}","received_events_url":"https://api.github.com/users/danielyaa5/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-03T15:45:46Z","updated_at":"2015-06-03T17:11:57Z","closed_at":null,"body":"So I was able to run the example from the wiki page no problem.... on Mac.\r\n\r\nBut for some reason whenever I try to do the installation on a PC I can't run the example. I double checked to make sure Im doing the installation right (installing node-gyp globally, installing python and visual studio 2013 express). But when I try to run the example I get the error message saying something like \r\n\r\nthrow new Error('Dynamic Linking Error: ' + err)\r\nError: Dynamic Linking Error: \"libm.dll\": The specified module could not be found.\r\n\r\nThe full error message in the command prompt can be seen in the picture below.\r\n![ffi-error](https://cloud.githubusercontent.com/assets/6629098/7964437/bb4086d4-09e5-11e5-897d-34e36f7bb3da.png)\r\n\r\nI've tried this on a windows 7 and windows xp computer and get the same error when trying to run the example. My coworker said that I cant load dll's if using node-ffi on a Mac, only .os files, is this true?\r\n\r\nThanks in advance for any help.\r\n"},"comment":{"url":"https://api.github.com/repos/node-ffi/node-ffi/issues/comments/108527445","html_url":"https://github.com/node-ffi/node-ffi/issues/208#issuecomment-108527445","issue_url":"https://api.github.com/repos/node-ffi/node-ffi/issues/208","id":108527445,"user":{"login":"rodrigopandini","id":641525,"avatar_url":"https://avatars.githubusercontent.com/u/641525?v=3","gravatar_id":"","url":"https://api.github.com/users/rodrigopandini","html_url":"https://github.com/rodrigopandini","followers_url":"https://api.github.com/users/rodrigopandini/followers","following_url":"https://api.github.com/users/rodrigopandini/following{/other_user}","gists_url":"https://api.github.com/users/rodrigopandini/gists{/gist_id}","starred_url":"https://api.github.com/users/rodrigopandini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodrigopandini/subscriptions","organizations_url":"https://api.github.com/users/rodrigopandini/orgs","repos_url":"https://api.github.com/users/rodrigopandini/repos","events_url":"https://api.github.com/users/rodrigopandini/events{/privacy}","received_events_url":"https://api.github.com/users/rodrigopandini/received_events","type":"User","site_admin":false},"created_at":"2015-06-03T17:11:57Z","updated_at":"2015-06-03T17:11:57Z","body":"Try check if the path for dll is correct.\r\nI can run the example on win7 - 64bits.\r\n\r\nYou can use something like the code bellow to load in each platform without change your code:\r\n```js\r\nvar os = require(\"os\"),\r\n  path = require(\"path\"),\r\n  ffi = require(\"ffi\"),\r\n  ref = require(\"ref\");\r\n\r\nvar filePath = \"\";\r\n\r\nif ((os.platform() === \"win32\") || (os.platform() === \"win64\")) {\r\n  if (os.arch() === \"ia32\") {\r\n    filePath = path.join(__dirname, \"dll\", \"32\", \"myWinLib\");\r\n  } else if (os.arch() === \"x64\") {\r\n    filePath = path.join(__dirname, \"dll\", \"64\", \"myWinLib\");\r\n  }\r\n} else if (os.platform() === \"linux\") {\r\n  if (os.arch() === \"ia32\") {\r\n    filePath = path.join(__dirname, \"so\", \"32\", \"myLib\");\r\n  } else if (os.arch() === \"x64\") {\r\n    filePath = path.join(__dirname, \"so\", \"64\", \"myLib\");\r\n  }\r\n}\r\n\r\nvar lib = ffi.Library(filePath, {\r\n  \"funcA\": [\"int\", [\"char *\"]]\r\n});\r\n```\r\nPath structure:\r\n```\r\n|-- lib/\r\n|   |-- dll/\r\n|   |   |-- 32/\r\n|   |   `-- 64/\r\n|   |-- so/\r\n|   |   |-- 32/\r\n|   |   `-- 64/\r\n|   `-- app.js\r\n|-- node_modules/\r\n|   `-- nofe-ffi/\r\n```"}}