On Wednesday, 19 September 2012 at 17:31:41 UTC, Jacob Carlborg wrote:
On 2012-09-19 12:35, Chris wrote:
I tried to create a JNI library that - via C - accesses a D function. Calling D from C is not a problem, but when the whole stuff is wrapped
into a JNI library, I get the following error message:

Error:
Undefined symbols:
  "_environ", referenced from:
      _environ$non_lazy_ptr in libphobos2.a(process_61b_495.o)
     (maybe you meant: _environ$non_lazy_ptr)

I know it's a Mac specific thing and a fix exists (cf.
https://www.gnu.org/software/gnulib/manual/html_node/environ.html),
however it doesn't work in my case. process.d accesses environ in a similar way. I am not sure whether I get it all wrong, or whether it
isn't possible at all to do the JNI-C-D thing.

I have also read somewhere that JNI could be created directly using D, I haven't found an example, though. Does anyone know anything about it?
This would of course be more convenient.

A fix for that was applied last year. Which version of the compiler are you using?

https://github.com/D-Programming-Language/phobos/blob/master/std/process.d#L60

Thanks for your answer. I used dmd 2.051 which is still my system default due to compatibility issues (deprecated methods etc.). It didn't occur to me that it's (hopefully) the compiler version, especially because I saw the code snippet in process.d and didn't know it was a recent fix. I'll try the latest version.

Reply via email to