Hi Gerry,

"pointer_to_array" is probably what you're looking for.  See
http://julia.readthedocs.org/en/latest/manual/calling-c-and-fortran-code/#accessing-data-through-a-pointer
for more information.

Cheers,
   Kevin


On Sun, Aug 10, 2014 at 1:17 AM, Gerry Weaver <[email protected]> wrote:

> I forgot to mention that I'm trying to accomplish this with arrays right
> now. I can pass a Julia array to C and access it there, but I can't figure
> out how to convert it back to a Julia array from a C void pointer when
> calling back to Julia from C.
>
>
> On Sunday, August 10, 2014 1:57:18 AM UTC-5, Gerry Weaver wrote:
>>
>> Hello All,
>>
>> I have a C function called mycfunc that takes a callback function pointer
>> (cbfunc) and a void pointer (cbdata) as arguments. mycfunc calls the
>> callback function (cbfunc) passing the void pointer (cbdata) as its
>> argument. I'm trying to figure out how to pass a Julia type as the void
>> pointer argument and convert it back to the Julia type in the Julia
>> function passed as the callback function argument. I can do this with a
>> simple string, but I'm having some difficulty in figuring out how to do it
>> with arrays and other types. Any advice on this would be much appreciated.
>>
>>
>> typedef int (* mycallback)(void *cbdata);
>>
>> void mycfunc(mycallback cbfunc, void *cbdata)
>> {
>>   cbfunc(cbdata);
>> }
>>
>> Thanks,
>> -G
>>
>>
>>

Reply via email to