# Problem with shared library interfacing hardware devices

**URL:** <https://discourse.julialang.org/t/problem-with-shared-library-interfacing-hardware-devices/69612>\
**Category:** General Usage\
**Created:** [October 12, 2021, 9:44am UTC](https://discourse.julialang.org/t/problem-with-shared-library-interfacing-hardware-devices/69612 "2021-10-12T09:44:59Z")\
**Posts on this page:** 1\
**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:** [October 12, 2021, 9:44am UTC](https://discourse.julialang.org/t/problem-with-shared-library-interfacing-hardware-devices/69612/1 "2021-10-12T09:44:59Z")

</div>

Hi all,

I am using Julia to control a camera which comes with a shared library on Linux-Mint. The shared library provides APIs written in C++ . There are also header files containing definitions of types and constants concerning the device. I wrote Julia scripts to wrap C structs and types with Julia types. Here is the critical point. I use **ccall** function to call a function in the shared library . This function is supposed to return an opaque handle of the device. I use this format variant `ccall( (:function, "library"), ...)`. It failed to connect to the device. Then, I preload the shared library using `Libdl.dlopen` and use `ccall(:function,..., ...)` to call the function, but still got the same result. The same operation works perfectly fine in C.

I am wondering what could block connection to hardware devices. I do not know the details of `ccall` implementation in Julia. If anybody can give me some clues, that would be great help.

Have a nice day.

Sitthichat
