# Passing pointers to workers process results in null pointers

**URL:** <https://discourse.julialang.org/t/passing-pointers-to-workers-process-results-in-null-pointers/73418>\
**Category:** General Usage\
**Tags:** parallel, multithreading\
**Created:** [December 21, 2021, 6:18am UTC](https://discourse.julialang.org/t/passing-pointers-to-workers-process-results-in-null-pointers/73418 "2021-12-21T06:18:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bossax](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bossax/32/29872_2.png) [@Bossax](https://discourse.julialang.org/u/Bossax)\
**Post date:** [December 21, 2021, 6:18am UTC](https://discourse.julialang.org/t/passing-pointers-to-workers-process-results-in-null-pointers/73418/1 "2021-12-21T06:18:49Z")

</div>

Hi all,

I am writing a code to spawn an image acquisition routine on a worker process by passing a pointer pointing to a camera device. This pointer is used by C APIs to execute camera operations via `ccall`. The problem is, when a pointer `Ptr{}` is sent to a remote process, it is always set to NULL -` 0x000000000000000`, which makes the programs crash. Does anybody have a workaround for this issue?

Thanks a lot

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [December 21, 2021, 6:30am UTC](https://discourse.julialang.org/t/passing-pointers-to-workers-process-results-in-null-pointers/73418/2 "2021-12-21T06:30:17Z")

</div>

technically you can send a number and convert it back, really hacky though

```julia
julia> a
1-element Vector{Int64}:
 1

julia> Ptr{Int64}(UInt(pointer(a))) == pointer(a)
true

```

also, do different processes have access to same memory space?

---

<div class="post-metadata">

**Author:** ![Bossax](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bossax/32/29872_2.png) [@Bossax](https://discourse.julialang.org/u/Bossax)\
**Post date:** [December 21, 2021, 6:34am UTC](https://discourse.julialang.org/t/passing-pointers-to-workers-process-results-in-null-pointers/73418/3 "2021-12-21T06:34:14Z")

</div>

> also, do different processes have access to same memory space?

Yes, you are right. Should I put the camera handle in the shared memory space then?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [December 21, 2021, 6:38am UTC](https://discourse.julialang.org/t/passing-pointers-to-workers-process-results-in-null-pointers/73418/4 "2021-12-21T06:38:23Z")

</div>

if you’re in Linux I would assume the camera is abstracted as a `/dev` file handler by the OS, but idk the details, just guessing here

---

<div class="post-metadata">

**Author:** ![Bossax](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bossax/32/29872_2.png) [@Bossax](https://discourse.julialang.org/u/Bossax)\
**Post date:** [December 21, 2021, 8:26am UTC](https://discourse.julialang.org/t/passing-pointers-to-workers-process-results-in-null-pointers/73418/5 "2021-12-21T08:26:05Z")

</div>

Thanks a lot!
