Passing Dictionary from Julia to C function using ccall

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Passing Dictionary from Julia to C function using ccall

Alexander Lyapin
Is there way to pass Dictionary from Julia to C function using ccall???

I have to divide all dictionaries for subarrays and then send them to C... this is really long and leads to huge syntax. Is there way to pass whole dictionary at once?

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Passing Dictionary from Julia to C function using ccall

Yichao Yu
Hmmm, I thought you can't start a new thread on julia-users anymore....

On Tue, Nov 22, 2016 at 2:18 AM, Alexander Lyapin
<[hidden email]> wrote:
> Is there way to pass Dictionary from Julia to C function using ccall???
>
> I have to divide all dictionaries for subarrays and then send them to C...
> this is really long and leads to huge syntax. Is there way to pass whole
> dictionary at once?

You can just pass a pointer to the dict to C with `Any` as argument
type. This works for any types.

Note that there's no standard representation of dict in C though so
accessing it in C is not trivial
(https://groups.google.com/forum/?fromgroups=#!msg/julia-users/E4FNM7m_Alw/3s6ePRzTAgAJ;context-place=searchin/julia-users/Julia$20embedding%7Csort:relevance)
I also can't understand what exactly you want to do .......

>
> Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Passing Dictionary from Julia to C function using ccall

Stefan Karpinski
I'm not sure what's up with that – the group settings look correct (only manager, owners can start new threads), but Google Groups has confusing settings, doesn't always do what it's configured to do and is otherwise generally unreliable, so who knows? These are among the reasons we're switching away. Please use discourse.julialang.org – thanks!

On Tue, Nov 22, 2016 at 8:08 AM, Yichao Yu <[hidden email]> wrote:
Hmmm, I thought you can't start a new thread on julia-users anymore....

On Tue, Nov 22, 2016 at 2:18 AM, Alexander Lyapin
<[hidden email]> wrote:
> Is there way to pass Dictionary from Julia to C function using ccall???
>
> I have to divide all dictionaries for subarrays and then send them to C...
> this is really long and leads to huge syntax. Is there way to pass whole
> dictionary at once?

You can just pass a pointer to the dict to C with `Any` as argument
type. This works for any types.

Note that there's no standard representation of dict in C though so
accessing it in C is not trivial
(https://groups.google.com/forum/?fromgroups=#!msg/julia-users/E4FNM7m_Alw/3s6ePRzTAgAJ;context-place=searchin/julia-users/Julia$20embedding%7Csort:relevance)
I also can't understand what exactly you want to do .......

>
> Thank you