Initialize buffer for ccall

buffer = Ref{Array{Float64,1}} is certainly wrong. This a type, not even an instance of a Ref type — that is, buffer isa Type returns true. From the documentation, buffer should be an allocated array, i.e. buffer should be an Array{Float64,1} (a Vector{Float64}) of length buffer_size_samples.

Also, when you pass the buffer to the ccall it should be as a Ptr{Cdouble}. Julia knows how to pass an Array to a pointer argument. Note also that ccall will automatically convert arguments by calling convert — there’s no need to explicitly convert to UInt8 etcetera.

That is, it should probably look something like this:

function mcc172_a_in_scan_read(address::Integer, samples_per_channel::Integer, mcc172_num_channels::Integer, timeout::Real)
	status = Ref{UInt16}()
	buffer_size_samples = samples_per_channel * mcc172_num_channels
	buffer = Vector{Float64}(undef, buffer_size_samples)
	samples_read_per_channel = Ref{UInt32}()
	
	success = ccall((:mcc172_a_in_scan_read, "/usr/local/lib/libdaqhats.so"),
	    Cint, (UInt8, Ref{UInt16}, UInt32, Cdouble, Ptr{Cdouble}, UInt32, Ref{UInt32}), 
	    address, status, samples_per_channel, timeout, buffer, buffer_size_samples, samples_read_per_channel)
    return buffer, Int(samples_read_per_channel[]), status[]
end

or maybe resize!(buffer, samples_read_per_channel[] * mcc172_num_channels). Note that you don’t need to initialize the Ref arguments with a value since (if I understand the documentation for mcc172_a_in_scan_read correctly) they are purely output parameters.