Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-10 Thread Kenta Sato
Thank you for your correction.

So, the python/ directory in IJulia project is a residue of the historical 
process, and pyjulia (or other binding between Python and Julia) will 
enable %julia magic in IPython cells with a little effort.
At a glance, IHaskell (https://github.com/gibiansky/IHaskell) also seems to 
implement the IPython protocol without Python.

To tell the truth, the reason why I'm struggling to call Julia from Python 
is I'm planning to submit a proposal to Google Summer of Code.
Some other students seem to be interested in this kind of project. I'll do 
my best :)


P.S. As announced here (
https://groups.google.com/forum/#!topic/julia-users/Yw5pB4voy1s), I 
released DocOpt.jl package. 

On Tuesday, March 11, 2014 2:35:17 AM UTC+9, Steven G. Johnson wrote:
>
>
>
> On Sunday, March 9, 2014 10:20:23 PM UTC-4, Kenta Sato wrote:
>>
>> I know that pyjulia exists, but I didn't try it.
>> The core idea of pyjulia seems to be incorporated into IJulia, but they 
>> does not share the source code.
>> I'm going to investigate the functionality of PyCall.jl.
>>
>
> pyjulia and IJulia are completely separate.   IJulia does not use Python 
> at all.  (It typically is used to connect to IPython, but it can talk to 
> any server that speaks the IPython protocol, e.g. the Sublime-IJulia 
> front-end.)
>
> Historically, there was some overlap because the first attempt to get 
> Julia running in IPython was to add a Julia "magics" mode to IPython 
> running the Python kernel... i.e. it was running the Python kernel, but 
> with a special %julia marker you could execute Julia code blocks.  The 
> current IJulia completely rewrote the kernel in Julia for a variety of 
> reasons, however.   
>
> (It is still nice to have a %julia magics for the Python kernel of 
> IPython, but that is basically just a very thin wrapper around pyjulia.) 
>


Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-10 Thread Steven G. Johnson


On Sunday, March 9, 2014 10:20:23 PM UTC-4, Kenta Sato wrote:
>
> I know that pyjulia exists, but I didn't try it.
> The core idea of pyjulia seems to be incorporated into IJulia, but they 
> does not share the source code.
> I'm going to investigate the functionality of PyCall.jl.
>

pyjulia and IJulia are completely separate.   IJulia does not use Python at 
all.  (It typically is used to connect to IPython, but it can talk to any 
server that speaks the IPython protocol, e.g. the Sublime-IJulia front-end.)

Historically, there was some overlap because the first attempt to get Julia 
running in IPython was to add a Julia "magics" mode to IPython running the 
Python kernel... i.e. it was running the Python kernel, but with a special 
%julia marker you could execute Julia code blocks.  The current IJulia 
completely rewrote the kernel in Julia for a variety of reasons, however.   

(It is still nice to have a %julia magics for the Python kernel of IPython, 
but that is basically just a very thin wrapper around pyjulia.) 


Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-10 Thread Felipe Cruz
I'm sorry.

add julia/src dir to cffi include dir, because *options.h* it's not 
exported so JULIA_DIR/include/julia

Segunda-feira, 10 de Março de 2014 11:49:29 UTC-3, Felipe Cruz escreveu:
>
> Hi All!
>
> I started another project to integrate Python and Julia, but instead of 
> using Python ctypes, I'm using Python cffi: 
> https://github.com/felipecruz/pyju
>
> I found cffi much better than ctypes, plus, it brings PyPy compatibility. 
> There's already some code working but, so far, I needed to make some 
> workarounds to make it work.
>
> To use some julia.h macros, I need 2 declarations to be exported: jl_null 
> and jl_subtype plus add julia/src dir to cffi include dir, because it's not 
> exported so JULIA_DIR/include/julia
>
> I would be glad to join efforts with anyone.. But I'm also planning on 
> sign to GSCO 2014 with this task.
>
> regards,
>
>
>
>
> Domingo, 9 de Março de 2014 23:46:16 UTC-3, Kenta Sato escreveu:
>>
>> Thank you for you reply.
>>
>> I guess `jl_nothing` itself needs a predicate like `jl_is_nothing`, 
>> because `nothing` has its own type and all other types seem to have 
>> corresponding predicates.
>> Also, the direct value comparison with v == jl_nothing would be 
>> error-prone.
>> For instance, users of Julia C API may abuse it like `if (v = jl_nothing) 
>> {...}`, or even worse `if (jl_nothing = v) {...}`.
>> `jl_is_nothing` predicate will prevent this misuage.
>>
>> By the way, I'm curious about calling Julia from Python and want to make 
>> it a full-fledged Python package.
>> I really need a easy-to-use but fast computing tool that is available 
>> from the Python language. Now I'm using C/C++/Cython, but they need 
>> compiling in advance. I guess Julia is the answer.
>> Of course, I'm ready to work with Jake together.
>>
>> On Monday, March 10, 2014 2:09:10 AM UTC+9, Stefan Karpinski wrote:
>>>
>>> +1e99 to using starting with Jake's pyjulia instead of duplicating this 
>>> effort. It's much better for there to be one really great way to call Julia 
>>> from Python than many less good ways. That said, I've felt for some time 
>>> that this functionality really needs an owner – someone to turn it into a 
>>> real easy_install/pip-able package that just works, assuming you have an 
>>> appropriately configured Julia install. Perhaps you're interested in that? 
>>> Or you and Jake can work on it jointly?
>>>
>>>
>>> On Sun, Mar 9, 2014 at 1:05 PM, Isaiah Norton wrote:
>>>
 You might also consider starting from and contributing to - or at least 
 looking at - this:
  
 https://github.com/jakebolewski/pyjulia

 The important idea there is to use the existing PyCall machinery to do 
 conversions, which will save you a lot of headache (also, it does 
 everything using ctypes which will make cross-platform deployment much 
 simpler).


 On Sat, Mar 8, 2014 at 10:11 PM, Kenta Sato  wrote:

> Hi,
>
> I'm new to the Julia language, and I'm now trying the Julia C API in 
> order to call Julia functions from Python.
> I've become successful with calling some basic Julia functions such as 
> (*) and sqrt() and converting the returned values to corresponding ones 
> in 
> Python.
> But I've got into a trouble to check whether a return value from Julia 
> is `nothing` or not.
>
> In the julia.h header, there seems to be a related macro named 
> `jl_is_null(v)`, but I'm not sure that this is the predicate I want 
> because 
> its name is not `jl_is_nothing(v)` as expected.
>
> In addition, when I called `jl_is_null(v)`, I got a dynamic linking 
> error, which said:
>
> Traceback (most recent call last):
>>   File "sample.py", line 2, in 
>> import libjulia as jl
>> ImportError: dlopen(/Users/kenta/myapp/libjulia/libjulia.so, 2): 
>> Symbol not found: _jl_null
>>   Referenced from: /Users/kenta/myapp/libjulia/libjulia.so
>>   Expected in: flat namespace
>>  in /Users/kenta/myapp/libjulia/libjulia.so
>
>
> Please note that `libjulia.so` is the name of my python library.
>
>  libjulia.dylib contains `_jl_null` symbol but it is local one:
>
> /Users/kenta/vendor/julia% nm usr/lib/libjulia.dylib| grep jl_null 
>> [master]
>> 00c2a3f0 s _jl_null
>
>
> I've got stuck at this point. Could you give me some advice?
>
> Julia: commit b52f17544d70ebc41508d6776ab3ca0ac26ccb3
> OS: Mac OS X 10.9.2 (Mavericks)
>


>>>

Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-10 Thread Felipe Cruz
Hi All!

I started another project to integrate Python and Julia, but instead of 
using Python ctypes, I'm using Python 
cffi: https://github.com/felipecruz/pyju

I found cffi much better than ctypes, plus, it brings PyPy compatibility. 
There's already some code working but, so far, I needed to make some 
workarounds to make it work.

To use some julia.h macros, I need 2 declarations to be exported: jl_null 
and jl_subtype plus add julia/src dir to cffi include dir, because it's not 
exported so JULIA_DIR/include/julia

I would be glad to join efforts with anyone.. But I'm also planning on sign 
to GSCO 2014 with this task.

regards,




Domingo, 9 de Março de 2014 23:46:16 UTC-3, Kenta Sato escreveu:
>
> Thank you for you reply.
>
> I guess `jl_nothing` itself needs a predicate like `jl_is_nothing`, 
> because `nothing` has its own type and all other types seem to have 
> corresponding predicates.
> Also, the direct value comparison with v == jl_nothing would be 
> error-prone.
> For instance, users of Julia C API may abuse it like `if (v = jl_nothing) 
> {...}`, or even worse `if (jl_nothing = v) {...}`.
> `jl_is_nothing` predicate will prevent this misuage.
>
> By the way, I'm curious about calling Julia from Python and want to make 
> it a full-fledged Python package.
> I really need a easy-to-use but fast computing tool that is available from 
> the Python language. Now I'm using C/C++/Cython, but they need compiling in 
> advance. I guess Julia is the answer.
> Of course, I'm ready to work with Jake together.
>
> On Monday, March 10, 2014 2:09:10 AM UTC+9, Stefan Karpinski wrote:
>>
>> +1e99 to using starting with Jake's pyjulia instead of duplicating this 
>> effort. It's much better for there to be one really great way to call Julia 
>> from Python than many less good ways. That said, I've felt for some time 
>> that this functionality really needs an owner – someone to turn it into a 
>> real easy_install/pip-able package that just works, assuming you have an 
>> appropriately configured Julia install. Perhaps you're interested in that? 
>> Or you and Jake can work on it jointly?
>>
>>
>> On Sun, Mar 9, 2014 at 1:05 PM, Isaiah Norton wrote:
>>
>>> You might also consider starting from and contributing to - or at least 
>>> looking at - this:
>>>  
>>> https://github.com/jakebolewski/pyjulia
>>>
>>> The important idea there is to use the existing PyCall machinery to do 
>>> conversions, which will save you a lot of headache (also, it does 
>>> everything using ctypes which will make cross-platform deployment much 
>>> simpler).
>>>
>>>
>>> On Sat, Mar 8, 2014 at 10:11 PM, Kenta Sato  wrote:
>>>
 Hi,

 I'm new to the Julia language, and I'm now trying the Julia C API in 
 order to call Julia functions from Python.
 I've become successful with calling some basic Julia functions such as 
 (*) and sqrt() and converting the returned values to corresponding ones in 
 Python.
 But I've got into a trouble to check whether a return value from Julia 
 is `nothing` or not.

 In the julia.h header, there seems to be a related macro named 
 `jl_is_null(v)`, but I'm not sure that this is the predicate I want 
 because 
 its name is not `jl_is_nothing(v)` as expected.

 In addition, when I called `jl_is_null(v)`, I got a dynamic linking 
 error, which said:

 Traceback (most recent call last):
>   File "sample.py", line 2, in 
> import libjulia as jl
> ImportError: dlopen(/Users/kenta/myapp/libjulia/libjulia.so, 2): 
> Symbol not found: _jl_null
>   Referenced from: /Users/kenta/myapp/libjulia/libjulia.so
>   Expected in: flat namespace
>  in /Users/kenta/myapp/libjulia/libjulia.so


 Please note that `libjulia.so` is the name of my python library.

  libjulia.dylib contains `_jl_null` symbol but it is local one:

 /Users/kenta/vendor/julia% nm usr/lib/libjulia.dylib| grep jl_null 
> [master]
> 00c2a3f0 s _jl_null


 I've got stuck at this point. Could you give me some advice?

 Julia: commit b52f17544d70ebc41508d6776ab3ca0ac26ccb3
 OS: Mac OS X 10.9.2 (Mavericks)

>>>
>>>
>>

Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Kenta Sato
Thank you for you reply.

I guess `jl_nothing` itself needs a predicate like `jl_is_nothing`, because 
`nothing` has its own type and all other types seem to have corresponding 
predicates.
Also, the direct value comparison with v == jl_nothing would be error-prone.
For instance, users of Julia C API may abuse it like `if (v = jl_nothing) 
{...}`, or even worse `if (jl_nothing = v) {...}`.
`jl_is_nothing` predicate will prevent this misuage.

By the way, I'm curious about calling Julia from Python and want to make it 
a full-fledged Python package.
I really need a easy-to-use but fast computing tool that is available from 
the Python language. Now I'm using C/C++/Cython, but they need compiling in 
advance. I guess Julia is the answer.
Of course, I'm ready to work with Jake together.

On Monday, March 10, 2014 2:09:10 AM UTC+9, Stefan Karpinski wrote:
>
> +1e99 to using starting with Jake's pyjulia instead of duplicating this 
> effort. It's much better for there to be one really great way to call Julia 
> from Python than many less good ways. That said, I've felt for some time 
> that this functionality really needs an owner – someone to turn it into a 
> real easy_install/pip-able package that just works, assuming you have an 
> appropriately configured Julia install. Perhaps you're interested in that? 
> Or you and Jake can work on it jointly?
>
>
> On Sun, Mar 9, 2014 at 1:05 PM, Isaiah Norton 
> 
> > wrote:
>
>> You might also consider starting from and contributing to - or at least 
>> looking at - this:
>>  
>> https://github.com/jakebolewski/pyjulia
>>
>> The important idea there is to use the existing PyCall machinery to do 
>> conversions, which will save you a lot of headache (also, it does 
>> everything using ctypes which will make cross-platform deployment much 
>> simpler).
>>
>>
>> On Sat, Mar 8, 2014 at 10:11 PM, Kenta Sato 
>> > wrote:
>>
>>> Hi,
>>>
>>> I'm new to the Julia language, and I'm now trying the Julia C API in 
>>> order to call Julia functions from Python.
>>> I've become successful with calling some basic Julia functions such as 
>>> (*) and sqrt() and converting the returned values to corresponding ones in 
>>> Python.
>>> But I've got into a trouble to check whether a return value from Julia 
>>> is `nothing` or not.
>>>
>>> In the julia.h header, there seems to be a related macro named 
>>> `jl_is_null(v)`, but I'm not sure that this is the predicate I want because 
>>> its name is not `jl_is_nothing(v)` as expected.
>>>
>>> In addition, when I called `jl_is_null(v)`, I got a dynamic linking 
>>> error, which said:
>>>
>>> Traceback (most recent call last):
   File "sample.py", line 2, in 
 import libjulia as jl
 ImportError: dlopen(/Users/kenta/myapp/libjulia/libjulia.so, 2): Symbol 
 not found: _jl_null
   Referenced from: /Users/kenta/myapp/libjulia/libjulia.so
   Expected in: flat namespace
  in /Users/kenta/myapp/libjulia/libjulia.so
>>>
>>>
>>> Please note that `libjulia.so` is the name of my python library.
>>>
>>>  libjulia.dylib contains `_jl_null` symbol but it is local one:
>>>
>>> /Users/kenta/vendor/julia% nm usr/lib/libjulia.dylib| grep jl_null   
   [master]
 00c2a3f0 s _jl_null
>>>
>>>
>>> I've got stuck at this point. Could you give me some advice?
>>>
>>> Julia: commit b52f17544d70ebc41508d6776ab3ca0ac26ccb3
>>> OS: Mac OS X 10.9.2 (Mavericks)
>>>
>>
>>
>

Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Kenta Sato
Thank you for your reply.

I know that pyjulia exists, but I didn't try it.
The core idea of pyjulia seems to be incorporated into IJulia, but they 
does not share the source code.
I'm going to investigate the functionality of PyCall.jl.
Thanks again!


On Monday, March 10, 2014 2:05:42 AM UTC+9, Isaiah wrote:
>
> You might also consider starting from and contributing to - or at least 
> looking at - this:
>  
> https://github.com/jakebolewski/pyjulia
>
> The important idea there is to use the existing PyCall machinery to do 
> conversions, which will save you a lot of headache (also, it does 
> everything using ctypes which will make cross-platform deployment much 
> simpler).
>
>
> On Sat, Mar 8, 2014 at 10:11 PM, Kenta Sato 
> > wrote:
>
>> Hi,
>>
>> I'm new to the Julia language, and I'm now trying the Julia C API in 
>> order to call Julia functions from Python.
>> I've become successful with calling some basic Julia functions such as 
>> (*) and sqrt() and converting the returned values to corresponding ones in 
>> Python.
>> But I've got into a trouble to check whether a return value from Julia is 
>> `nothing` or not.
>>
>> In the julia.h header, there seems to be a related macro named 
>> `jl_is_null(v)`, but I'm not sure that this is the predicate I want because 
>> its name is not `jl_is_nothing(v)` as expected.
>>
>> In addition, when I called `jl_is_null(v)`, I got a dynamic linking 
>> error, which said:
>>
>> Traceback (most recent call last):
>>>   File "sample.py", line 2, in 
>>> import libjulia as jl
>>> ImportError: dlopen(/Users/kenta/myapp/libjulia/libjulia.so, 2): Symbol 
>>> not found: _jl_null
>>>   Referenced from: /Users/kenta/myapp/libjulia/libjulia.so
>>>   Expected in: flat namespace
>>>  in /Users/kenta/myapp/libjulia/libjulia.so
>>
>>
>> Please note that `libjulia.so` is the name of my python library.
>>
>>  libjulia.dylib contains `_jl_null` symbol but it is local one:
>>
>> /Users/kenta/vendor/julia% nm usr/lib/libjulia.dylib| grep jl_null   
>>>   [master]
>>> 00c2a3f0 s _jl_null
>>
>>
>> I've got stuck at this point. Could you give me some advice?
>>
>> Julia: commit b52f17544d70ebc41508d6776ab3ca0ac26ccb3
>> OS: Mac OS X 10.9.2 (Mavericks)
>>
>
>

Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Stefan Karpinski
+1e99 to using starting with Jake's pyjulia instead of duplicating this
effort. It's much better for there to be one really great way to call Julia
from Python than many less good ways. That said, I've felt for some time
that this functionality really needs an owner – someone to turn it into a
real easy_install/pip-able package that just works, assuming you have an
appropriately configured Julia install. Perhaps you're interested in that?
Or you and Jake can work on it jointly?


On Sun, Mar 9, 2014 at 1:05 PM, Isaiah Norton wrote:

> You might also consider starting from and contributing to - or at least
> looking at - this:
>
> https://github.com/jakebolewski/pyjulia
>
> The important idea there is to use the existing PyCall machinery to do
> conversions, which will save you a lot of headache (also, it does
> everything using ctypes which will make cross-platform deployment much
> simpler).
>
>
> On Sat, Mar 8, 2014 at 10:11 PM, Kenta Sato  wrote:
>
>> Hi,
>>
>> I'm new to the Julia language, and I'm now trying the Julia C API in
>> order to call Julia functions from Python.
>> I've become successful with calling some basic Julia functions such as
>> (*) and sqrt() and converting the returned values to corresponding ones in
>> Python.
>> But I've got into a trouble to check whether a return value from Julia is
>> `nothing` or not.
>>
>> In the julia.h header, there seems to be a related macro named
>> `jl_is_null(v)`, but I'm not sure that this is the predicate I want because
>> its name is not `jl_is_nothing(v)` as expected.
>>
>> In addition, when I called `jl_is_null(v)`, I got a dynamic linking
>> error, which said:
>>
>> Traceback (most recent call last):
>>>   File "sample.py", line 2, in 
>>> import libjulia as jl
>>> ImportError: dlopen(/Users/kenta/myapp/libjulia/libjulia.so, 2): Symbol
>>> not found: _jl_null
>>>   Referenced from: /Users/kenta/myapp/libjulia/libjulia.so
>>>   Expected in: flat namespace
>>>  in /Users/kenta/myapp/libjulia/libjulia.so
>>
>>
>> Please note that `libjulia.so` is the name of my python library.
>>
>>  libjulia.dylib contains `_jl_null` symbol but it is local one:
>>
>> /Users/kenta/vendor/julia% nm usr/lib/libjulia.dylib| grep jl_null
>>>   [master]
>>> 00c2a3f0 s _jl_null
>>
>>
>> I've got stuck at this point. Could you give me some advice?
>>
>> Julia: commit b52f17544d70ebc41508d6776ab3ca0ac26ccb3
>> OS: Mac OS X 10.9.2 (Mavericks)
>>
>
>


Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Isaiah Norton
You might also consider starting from and contributing to - or at least
looking at - this:

https://github.com/jakebolewski/pyjulia

The important idea there is to use the existing PyCall machinery to do
conversions, which will save you a lot of headache (also, it does
everything using ctypes which will make cross-platform deployment much
simpler).


On Sat, Mar 8, 2014 at 10:11 PM, Kenta Sato  wrote:

> Hi,
>
> I'm new to the Julia language, and I'm now trying the Julia C API in order
> to call Julia functions from Python.
> I've become successful with calling some basic Julia functions such as (*)
> and sqrt() and converting the returned values to corresponding ones in
> Python.
> But I've got into a trouble to check whether a return value from Julia is
> `nothing` or not.
>
> In the julia.h header, there seems to be a related macro named
> `jl_is_null(v)`, but I'm not sure that this is the predicate I want because
> its name is not `jl_is_nothing(v)` as expected.
>
> In addition, when I called `jl_is_null(v)`, I got a dynamic linking error,
> which said:
>
> Traceback (most recent call last):
>>   File "sample.py", line 2, in 
>> import libjulia as jl
>> ImportError: dlopen(/Users/kenta/myapp/libjulia/libjulia.so, 2): Symbol
>> not found: _jl_null
>>   Referenced from: /Users/kenta/myapp/libjulia/libjulia.so
>>   Expected in: flat namespace
>>  in /Users/kenta/myapp/libjulia/libjulia.so
>
>
> Please note that `libjulia.so` is the name of my python library.
>
>  libjulia.dylib contains `_jl_null` symbol but it is local one:
>
> /Users/kenta/vendor/julia% nm usr/lib/libjulia.dylib| grep jl_null
>> [master]
>> 00c2a3f0 s _jl_null
>
>
> I've got stuck at this point. Could you give me some advice?
>
> Julia: commit b52f17544d70ebc41508d6776ab3ca0ac26ccb3
> OS: Mac OS X 10.9.2 (Mavericks)
>


Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Stefan Karpinski
There is a unique instance of the Nothing type called `nothing`. In
C, `jl_nothing` is a pointer to that value. Since the instance is unique,
you can just check pointer equality: `v == jl_nothing`. The reason you get
a linking error for jl_is_null is that it is a macro:

src/julia.h
490:#define jl_is_null(v)(((jl_value_t*)(v)) ==
((jl_value_t*)jl_null))


This just does a pointer comparison to the jl_null object but with casting
so that there aren't any compiler warnings. You probably shouldn't be using
jl_null, however – it's just the empty tuple, and its usage in the C code
is largely a vestige of an earlier era in Julia's history when the empty
tuple was used as a nothing value the way the empty list is used as a
nothing value in Lisp. (It does have the advantage of not depending on any
types that aren't built into the language, however, which makes it useful
during bootstrapping.)


On Sat, Mar 8, 2014 at 10:11 PM, Kenta Sato  wrote:

> Hi,
>
> I'm new to the Julia language, and I'm now trying the Julia C API in order
> to call Julia functions from Python.
> I've become successful with calling some basic Julia functions such as (*)
> and sqrt() and converting the returned values to corresponding ones in
> Python.
> But I've got into a trouble to check whether a return value from Julia is
> `nothing` or not.
>
> In the julia.h header, there seems to be a related macro named
> `jl_is_null(v)`, but I'm not sure that this is the predicate I want because
> its name is not `jl_is_nothing(v)` as expected.
>
> In addition, when I called `jl_is_null(v)`, I got a dynamic linking error,
> which said:
>
> Traceback (most recent call last):
>>   File "sample.py", line 2, in 
>> import libjulia as jl
>> ImportError: dlopen(/Users/kenta/myapp/libjulia/libjulia.so, 2): Symbol
>> not found: _jl_null
>>   Referenced from: /Users/kenta/myapp/libjulia/libjulia.so
>>   Expected in: flat namespace
>>  in /Users/kenta/myapp/libjulia/libjulia.so
>
>
> Please note that `libjulia.so` is the name of my python library.
>
>  libjulia.dylib contains `_jl_null` symbol but it is local one:
>
> /Users/kenta/vendor/julia% nm usr/lib/libjulia.dylib| grep jl_null
>> [master]
>> 00c2a3f0 s _jl_null
>
>
> I've got stuck at this point. Could you give me some advice?
>
> Julia: commit b52f17544d70ebc41508d6776ab3ca0ac26ccb3
> OS: Mac OS X 10.9.2 (Mavericks)
>


[julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Kenta Sato
Hi,

I'm new to the Julia language, and I'm now trying the Julia C API in order 
to call Julia functions from Python.
I've become successful with calling some basic Julia functions such as (*) 
and sqrt() and converting the returned values to corresponding ones in 
Python.
But I've got into a trouble to check whether a return value from Julia is 
`nothing` or not.

In the julia.h header, there seems to be a related macro named 
`jl_is_null(v)`, but I'm not sure that this is the predicate I want because 
its name is not `jl_is_nothing(v)` as expected.

In addition, when I called `jl_is_null(v)`, I got a dynamic linking error, 
which said:

Traceback (most recent call last):
>   File "sample.py", line 2, in 
> import libjulia as jl
> ImportError: dlopen(/Users/kenta/myapp/libjulia/libjulia.so, 2): Symbol 
> not found: _jl_null
>   Referenced from: /Users/kenta/myapp/libjulia/libjulia.so
>   Expected in: flat namespace
>  in /Users/kenta/myapp/libjulia/libjulia.so


Please note that `libjulia.so` is the name of my python library.

 libjulia.dylib contains `_jl_null` symbol but it is local one:

/Users/kenta/vendor/julia% nm usr/lib/libjulia.dylib| grep jl_null 
> [master]
> 00c2a3f0 s _jl_null


I've got stuck at this point. Could you give me some advice?

Julia: commit b52f17544d70ebc41508d6776ab3ca0ac26ccb3
OS: Mac OS X 10.9.2 (Mavericks)