{"action":"opened","issue":{"url":"https://api.github.com/repos/rubinius/rubinius/issues/3446","labels_url":"https://api.github.com/repos/rubinius/rubinius/issues/3446/labels{/name}","comments_url":"https://api.github.com/repos/rubinius/rubinius/issues/3446/comments","events_url":"https://api.github.com/repos/rubinius/rubinius/issues/3446/events","html_url":"https://github.com/rubinius/rubinius/issues/3446","id":89938277,"number":3446,"title":"environ doesn't work on Mac if you ever build Rubinius as a shared library","user":{"login":"chrisseaton","id":341094,"avatar_url":"https://avatars.githubusercontent.com/u/341094?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisseaton","html_url":"https://github.com/chrisseaton","followers_url":"https://api.github.com/users/chrisseaton/followers","following_url":"https://api.github.com/users/chrisseaton/following{/other_user}","gists_url":"https://api.github.com/users/chrisseaton/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisseaton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisseaton/subscriptions","organizations_url":"https://api.github.com/users/chrisseaton/orgs","repos_url":"https://api.github.com/users/chrisseaton/repos","events_url":"https://api.github.com/users/chrisseaton/events{/privacy}","received_events_url":"https://api.github.com/users/chrisseaton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-21T17:39:05Z","updated_at":"2015-06-21T17:39:05Z","closed_at":null,"body":"If anyone ever has any aspiration to build Rubinius as a shared library or a bundle, perhaps to embed it or something like that, the use of `environ` in `ENV` is incorrect on the Mac when the code is dynamically loaded. You need to use `_NSGetEnviron` from `<crt_externs.h>` instead. It's an annoying bug that we found using the Rubinius `ENV` code for the first time, as most things appear to work but setting a new variable doesn't take hold when you look for it again.\r\n\r\nI don't know if you currently inline through to making FFI calls directly from generated native code, but if you don't at the moment it's possible this bug would also appear there - not sure if dynamically generated code also needs `_NSGetEnviron`."}}