Case 6: Passing a value to ccall

In the following example, the exp function from the C library is used to calculate the exponent of a number. It expects a Float64 value as an argument, so when the value of 2 is passed to ccall, it is converted to 2.0 before being passed to the C function:

All that is good, but something seems to be missing. What about the most common use case: passing an argument to a function? Wouldn't it be called if Julia auto-converts the arguments as well? The answer may be a little surprising. Let's look at this in more detail in the following sections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.233.41