ReadOnlyMemoryError()问题

在NI的官网下载了 C DLL TDM.zip 文件,地址是 http://www.ni.com/white-paper/3727/zhs/, 想测试用于读取一个tdms文件,在julia里面打开文件时一直出现ReadOnlyMemoryError()
Julia里代码如下:
fhandl = 1;
ccall((:DDC_OpenFile, “D:\programs\julia\nilibddc.dll”),
Int32, (Cstring, Cstring, Int64,), “D:\programs\julia\SineData.tdm”, “TDM”, fhandl)

ni的原函数是
int DDC_OpenFile (const char *filePath, const char *fileType, DDCFileHandle *file);

不知道我代码哪里错了呢?

DDCFileHandle *file 是个指针,用 Int64 不匹配吧

我用matlab调用出来这个输出值得到一个uint64的数字,所以在这里我就用Int64了。用Ptr{Int64}就会报错,像这种DDCFileHandle 类型的指针应该怎么写才对呢?

DDCFileHandle 不是基本类型,看头文件里是怎么声明的,如果是 opaque struct typedef 就直接用 Ptr{Cvoid} 就好。BTW,需要大量封装 C 库可以试试 Clang.jl

这个是头文件里面的声明:
typedef DDCFile* DDCFileHandle;

我用matlab调用的时候用到了这个头文件,用Julia的时候没有用到,不知道这是对的吗?

如果用Ptr{Cvoid} 的话,那输入参数应该如何写呢?我直接把Int64改成了Ptr{Cvoid} ,报错说我的输入参数是Int64的无法转换类型

它就是一个 opaque struct typedef,DDCFileHandle 作为 DDCFile 的 typealias,DDCFile 的实现是不暴露给用户的,用户需要用提供的 API 来操作 DDCFile (即其它函数会接收 DDCFileHandle或其指针类型)。

这种通常的做法是在 Julia 里定义

const DDCFile = Cvoid;
const DDCFileHandle = Ptr{DDCFile};

然后这样调:

fhdlRef = Ref{Ptr{DDCFileHandle}}(C_NULL)

ccall((:DDC_OpenFile, "D:\programs\julia\nilibddc.dll"), Int32, (Cstring, Cstring, Ptr{DDCFileHandle }), "D:\programs\julia\SineData.tdm", "TDM", fhdlRef)

fhdl = fhdlRef[]

它输出的这个数字应该是个指针地址吧? 可以多贴点例子和图。

是的,DDC_OpenFile是打开文件的,那个DDCFileHandle 类型的指针就是指向文件句柄的一个指针。我用你给的代码已经能顺利打开文件了,没有报错。运行后得到
fhdl = Ptr{Ptr{Nothing}} @0x0000000021e0e010

还想再请教一下,代码中Ptr{DDCFile}应该是指向DDCFile的指针,那么Ref{}()的意义是什么呢?

sorry, 我写错了,应该是 fhdlRef = Ref{DDCFileHandle}(C_NULL),一般 ccall 里的函数 signature 写 Ptr{} (也有特例,具体看文档),外面 Julia 用 Ref 来定义变量,Ref 可以保证 GC 安全,即你得到的那个指针不会无意中被回收掉,除非这个变量在代码里确实已经没有 reference 了。

DDC_OpenFile 直接传 fhdlRef 进去就可以,不需要用 fhdlRef 解析,之前的写法看错了多套了一层

我明白啦,太感谢啦~

又遇到一个新问题想请教一下,以下是代码,前面open file 和get number of channel groups那两段运行无问题,文件正确载入,并获取了文件中有两个channelgroups

# open file
const DDCFileHandle = Ptr{Cvoid};
fhdlRef = Ref{DDCFileHandle}(C_NULL)
err = ccall((:DDC_OpenFile, "nilibddc.dll"), Int32,
    (Cstring, Cstring, DDCFileHandle), "SineData.tdm",
    "TDM", fhdlRef)
fhdl = fhdlRef[]
@show fhdl
@show err

# get number of channel groups
nGropIn = Ref{UInt32}(C_NULL)
err = ccall((:DDC_GetNumChannelGroups, "nilibddc.dll"), Int32,
    (DDCFileHandle, Ptr{Cuint}), fhdl, nGropIn)
nGrop = nGropIn[]
@show err
@show nGrop

问题出在接下来的这段代码,这段代码的目的是获取文件中channelgroups的handle:

# get channel groups
const DDCChannelGroupHandle = Cvoid;
grpsIn = Array{DDCChannelGroupHandle}(undef, nGrop)
err = ccall((:DDC_GetChannelGroups, "nilibddc.dll"), Int32,
    (DDCFileHandle, Array{DDCChannelGroupHandle}, Csize_t), fhdl, grpsIn, nGrop)
@show err
@show grpsIn

帮助中定义的原函数如下,输入第一个参数是文件handle,第三个是channelgroups的数量,输出是第二个channelgroups的handle:

int DDC_GetChannelGroups (DDCFileHandle file, DDCChannelGroupHandle channelGroupsBuffer[], size_t numberOfChannelGroups);

这里的channelGroupsBuffer是一个DDCChannelGroupHandle类型的数组,在matlab里面调用是反回一个uint64的向量,值是句柄值。出问题的这段代码,函数并未报错,返回err=0,而输出的grpsIn却是nothing:

grpsIn = Nothing[nothing, nothing]

想请教一下这里问题出在什么地方呢?

err = ccall((:DDC_GetChannelGroups, "nilibddc.dll"), Int32,
    (DDCFileHandle, Ptr{DDCChannelGroupHandle}, Csize_t), fhdl, grpsIn, nGrop)

仔细读文档,或者用 Clang.jl :wink:

Similarly, for array arguments ( T[] or T* ), the Julia type should again be Ptr{T} , not Vector{T} .

soga~,不知道这个文档是在哪里看的呢,我都在网上看的中文文档,没注意到这些呢
https://julia-cn.readthedocs.io/zh_CN/latest/

这么改之后运行还是得到 grpsIn = Nothing[nothing, nothing], 请问grpsIn = Array{DDCChannelGroupHandle}(undef, nGrop)这里是否应该作相应的修改呢

论坛上面第二个就是文档。我没看过头文件,你确定 const DDCChannelGroupHandle = Cvoid 是Cvoid 而不是 Ptr{Cvoid} ?

头文件是这 么定义的:

typedef struct _DDCFile            DDCFile;
typedef struct _DDCChannelGroup      DDCChannelGroup;
typedef struct _DDCChannel         DDCChannel;

typedef DDCFile*               DDCFileHandle;
typedef DDCChannelGroup*         DDCChannelGroupHandle;
typedef DDCChannel*               DDCChannelHandle;

写成Ptr{Cvoid}好像是会报错

DDCFile → Cvoid, DDCFileHandle → Ptr{Cvoid}

对应的:

DDCChannelGroup → Cvoid, DDCChannelGroupHandle → Ptr{Cvoid}

int DDC_GetChannelGroupPropertyNames (DDCChannelGroupHandle channelGroup, char **propertyNames, size_t numberOfPropertyNames);

像这样的,中间那个char **propertyNames是否就是输入 Ptr{Ptr{Cchar}}(C_NULL)?

是的,如果是输入变量,就用 Ptr{Cchar}["xxx"]

用 Clang.jl 生成的,仅供参考:

const DDC_FILE_TYPE_TDM = "TDM"
const DDC_FILE_TYPE_TDM_STREAMING = "TDMS"
const DDC_FILE_NAME = "name"
const DDC_FILE_DESCRIPTION = "description"
const DDC_FILE_TITLE = "title"
const DDC_FILE_AUTHOR = "author"
const DDC_FILE_DATETIME = "datetime"
const DDC_CHANNELGROUP_NAME = "name"
const DDC_CHANNELGROUP_DESCRIPTION = "description"
const DDC_CHANNEL_NAME = "name"
const DDC_CHANNEL_DESCRIPTION = "description"
const DDC_CHANNEL_UNIT_STRING = "unit_string"
const DDC_CHANNEL_MINIMUM = "minimum"
const DDC_CHANNEL_MAXIMUM = "maximum"
const _DDCFile = Cvoid
const DDCFile = _DDCFile
const _DDCChannelGroup = Cvoid
const DDCChannelGroup = _DDCChannelGroup
const _DDCChannel = Cvoid
const DDCChannel = _DDCChannel
const DDCFileHandle = Ptr{DDCFile}
const DDCChannelGroupHandle = Ptr{DDCChannelGroup}
const DDCChannelHandle = Ptr{DDCChannel}

@cenum(DDCDataType,
    DDC_UInt8 = 5,
    DDC_Int16 = 2,
    DDC_Int32 = 3,
    DDC_Float = 9,
    DDC_Double = 10,
    DDC_String = 23,
    DDC_Timestamp = 30,
)

# Julia wrapper for header: /Users/gnimuc/Downloads/TDM C DLL/dev/include/nilibddc.h
# Automatically generated using Clang.jl wrap_c


function DDC_CreateFile(filePath, fileType, name, description, title, author, file)
    ccall((:DDC_CreateFile, libddc), Cint, (Cstring, Cstring, Cstring, Cstring, Cstring, Cstring, Ptr{DDCFileHandle}), filePath, fileType, name, description, title, author, file)
end

function DDC_AddChannelGroup(file, name, description, channelGroup)
    ccall((:DDC_AddChannelGroup, libddc), Cint, (DDCFileHandle, Cstring, Cstring, Ptr{DDCChannelGroupHandle}), file, name, description, channelGroup)
end

function DDC_AddChannel(channelGroup, dataType, name, description, unitString, channel)
    ccall((:DDC_AddChannel, libddc), Cint, (DDCChannelGroupHandle, DDCDataType, Cstring, Cstring, Cstring, Ptr{DDCChannelHandle}), channelGroup, dataType, name, description, unitString, channel)
end

function DDC_SaveFile(file)
    ccall((:DDC_SaveFile, libddc), Cint, (DDCFileHandle,), file)
end

function DDC_CloseFile(file)
    ccall((:DDC_CloseFile, libddc), Cint, (DDCFileHandle,), file)
end

function DDC_OpenFileEx(filePath, fileType, readOnly, file)
    ccall((:DDC_OpenFileEx, libddc), Cint, (Cstring, Cstring, Cint, Ptr{DDCFileHandle}), filePath, fileType, readOnly, file)
end

function DDC_RemoveChannelGroup(channelGroup)
    ccall((:DDC_RemoveChannelGroup, libddc), Cint, (DDCChannelGroupHandle,), channelGroup)
end

function DDC_RemoveChannel(channel)
    ccall((:DDC_RemoveChannel, libddc), Cint, (DDCChannelHandle,), channel)
end

function DDC_CloseChannelGroup(channelGroup)
    ccall((:DDC_CloseChannelGroup, libddc), Cint, (DDCChannelGroupHandle,), channelGroup)
end

function DDC_CloseChannel(channel)
    ccall((:DDC_CloseChannel, libddc), Cint, (DDCChannelHandle,), channel)
end

function DDC_OpenFile(filePath, fileType, file)
    ccall((:DDC_OpenFile, libddc), Cint, (Cstring, Cstring, Ptr{DDCFileHandle}), filePath, fileType, file)
end

function DDC_SetDataValues(channel, values, numValues)
    ccall((:DDC_SetDataValues, libddc), Cint, (DDCChannelHandle, Ptr{Cvoid}, Csize_t), channel, values, numValues)
end

function DDC_SetDataValuesTimestampComponents(channel, year, month, day, hour, minute, second, milliSecond, numValues)
    ccall((:DDC_SetDataValuesTimestampComponents, libddc), Cint, (DDCChannelHandle, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{Cdouble}, Csize_t), channel, year, month, day, hour, minute, second, milliSecond, numValues)
end

function DDC_AppendDataValues(channel, values, numValues)
    ccall((:DDC_AppendDataValues, libddc), Cint, (DDCChannelHandle, Ptr{Cvoid}, Csize_t), channel, values, numValues)
end

function DDC_AppendDataValuesTimestampComponents(channel, year, month, day, hour, minute, second, milliSecond, numValues)
    ccall((:DDC_AppendDataValuesTimestampComponents, libddc), Cint, (DDCChannelHandle, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{Cdouble}, Csize_t), channel, year, month, day, hour, minute, second, milliSecond, numValues)
end

function DDC_ReplaceDataValues(channel, indexOfFirstValueToReplace, values, numValues)
    ccall((:DDC_ReplaceDataValues, libddc), Cint, (DDCChannelHandle, Csize_t, Ptr{Cvoid}, Csize_t), channel, indexOfFirstValueToReplace, values, numValues)
end

function DDC_ReplaceDataValuesTimestampComponents(channel, indexOfFirstValueToReplace, year, month, day, hour, minute, second, milliSecond, numValues)
    ccall((:DDC_ReplaceDataValuesTimestampComponents, libddc), Cint, (DDCChannelHandle, Csize_t, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{Cdouble}, Csize_t), channel, indexOfFirstValueToReplace, year, month, day, hour, minute, second, milliSecond, numValues)
end

function DDC_GetNumChannelGroups(file, numChannelGroups)
    ccall((:DDC_GetNumChannelGroups, libddc), Cint, (DDCFileHandle, Ptr{UInt32}), file, numChannelGroups)
end

function DDC_GetChannelGroups(file, channelGroupsBuf, numChannelGroups)
    ccall((:DDC_GetChannelGroups, libddc), Cint, (DDCFileHandle, Ptr{DDCChannelGroupHandle}, Csize_t), file, channelGroupsBuf, numChannelGroups)
end

function DDC_GetNumChannels(channelGroup, numChannels)
    ccall((:DDC_GetNumChannels, libddc), Cint, (DDCChannelGroupHandle, Ptr{UInt32}), channelGroup, numChannels)
end

function DDC_GetChannels(channelGroup, channelsBuf, numChannels)
    ccall((:DDC_GetChannels, libddc), Cint, (DDCChannelGroupHandle, Ptr{DDCChannelHandle}, Csize_t), channelGroup, channelsBuf, numChannels)
end

function DDC_GetNumDataValues(channel, __int64)
    ccall((:DDC_GetNumDataValues, libddc), Cint, (DDCChannelHandle, UInt32), channel, __int64)
end

function DDC_GetDataValues(channel, indexOfFirstValueToGet, numValuesToGet, values)
    ccall((:DDC_GetDataValues, libddc), Cint, (DDCChannelHandle, Csize_t, Csize_t, Ptr{Cvoid}), channel, indexOfFirstValueToGet, numValuesToGet, values)
end

function DDC_GetDataValuesTimestampComponents(channel, indexOfFirstValueToGet, numValuesToGet, year, month, day, hour, minute, second, milliSecond, weekDay)
    ccall((:DDC_GetDataValuesTimestampComponents, libddc), Cint, (DDCChannelHandle, Csize_t, Csize_t, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{Cdouble}, Ptr{UInt32}), channel, indexOfFirstValueToGet, numValuesToGet, year, month, day, hour, minute, second, milliSecond, weekDay)
end

function DDC_GetDataType(channel, dataType)
    ccall((:DDC_GetDataType, libddc), Cint, (DDCChannelHandle, Ptr{DDCDataType}), channel, dataType)
end

function DDC_SetFilePropertyTimestampComponents(file, property, year, month, day, hour, minute, second, milliSecond)
    ccall((:DDC_SetFilePropertyTimestampComponents, libddc), Cint, (DDCFileHandle, Cstring, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, Cdouble), file, property, year, month, day, hour, minute, second, milliSecond)
end

function DDC_GetFileProperty(file, property, value, valueSizeInBytes)
    ccall((:DDC_GetFileProperty, libddc), Cint, (DDCFileHandle, Cstring, Ptr{Cvoid}, Csize_t), file, property, value, valueSizeInBytes)
end

function DDC_GetFilePropertyTimestampComponents(file, property, year, month, day, hour, minute, second, milliSecond, weekDay)
    ccall((:DDC_GetFilePropertyTimestampComponents, libddc), Cint, (DDCFileHandle, Cstring, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{Cdouble}, Ptr{UInt32}), file, property, year, month, day, hour, minute, second, milliSecond, weekDay)
end

function DDC_GetFileStringPropertyLength(file, property, length)
    ccall((:DDC_GetFileStringPropertyLength, libddc), Cint, (DDCFileHandle, Cstring, Ptr{UInt32}), file, property, length)
end

function DDC_CreateFilePropertyTimestampComponents(file, property, year, month, day, hour, minute, second, milliSecond)
    ccall((:DDC_CreateFilePropertyTimestampComponents, libddc), Cint, (DDCFileHandle, Cstring, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, Cdouble), file, property, year, month, day, hour, minute, second, milliSecond)
end

function DDC_FilePropertyExists(file, property, exists)
    ccall((:DDC_FilePropertyExists, libddc), Cint, (DDCFileHandle, Cstring, Ptr{Cint}), file, property, exists)
end

function DDC_GetNumFileProperties(file, numProperties)
    ccall((:DDC_GetNumFileProperties, libddc), Cint, (DDCFileHandle, Ptr{UInt32}), file, numProperties)
end

function DDC_GetFilePropertyNames(file, propertyNames, numPropertyNames)
    ccall((:DDC_GetFilePropertyNames, libddc), Cint, (DDCFileHandle, Ptr{Cstring}, Csize_t), file, propertyNames, numPropertyNames)
end

function DDC_GetFilePropertyType(file, property, dataType)
    ccall((:DDC_GetFilePropertyType, libddc), Cint, (DDCFileHandle, Cstring, Ptr{DDCDataType}), file, property, dataType)
end

function DDC_SetChannelGroupPropertyTimestampComponents(channelGroup, property, year, month, day, hour, minute, second, milliSecond)
    ccall((:DDC_SetChannelGroupPropertyTimestampComponents, libddc), Cint, (DDCChannelGroupHandle, Cstring, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, Cdouble), channelGroup, property, year, month, day, hour, minute, second, milliSecond)
end

function DDC_GetChannelGroupProperty(channelGroup, property, value, valueSizeInBytes)
    ccall((:DDC_GetChannelGroupProperty, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{Cvoid}, Csize_t), channelGroup, property, value, valueSizeInBytes)
end

function DDC_GetChannelGroupPropertyTimestampComponents(channelGroup, property, year, month, day, hour, minute, second, milliSecond, weekDay)
    ccall((:DDC_GetChannelGroupPropertyTimestampComponents, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{Cdouble}, Ptr{UInt32}), channelGroup, property, year, month, day, hour, minute, second, milliSecond, weekDay)
end

function DDC_GetChannelGroupStringPropertyLength(channelGroup, property, length)
    ccall((:DDC_GetChannelGroupStringPropertyLength, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{UInt32}), channelGroup, property, length)
end

function DDC_CreateChannelGroupPropertyTimestampComponents(channelGroup, property, year, month, day, hour, minute, second, milliSecond)
    ccall((:DDC_CreateChannelGroupPropertyTimestampComponents, libddc), Cint, (DDCChannelGroupHandle, Cstring, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, Cdouble), channelGroup, property, year, month, day, hour, minute, second, milliSecond)
end

function DDC_ChannelGroupPropertyExists(channelGroup, property, exists)
    ccall((:DDC_ChannelGroupPropertyExists, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{Cint}), channelGroup, property, exists)
end

function DDC_GetNumChannelGroupProperties(channelGroup, numProperties)
    ccall((:DDC_GetNumChannelGroupProperties, libddc), Cint, (DDCChannelGroupHandle, Ptr{UInt32}), channelGroup, numProperties)
end

function DDC_GetChannelGroupPropertyNames(channelGroup, propertyNames, numPropertyNames)
    ccall((:DDC_GetChannelGroupPropertyNames, libddc), Cint, (DDCChannelGroupHandle, Ptr{Cstring}, Csize_t), channelGroup, propertyNames, numPropertyNames)
end

function DDC_GetChannelGroupPropertyType(channelGroup, property, dataType)
    ccall((:DDC_GetChannelGroupPropertyType, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{DDCDataType}), channelGroup, property, dataType)
end

function DDC_SetChannelPropertyTimestampComponents(channel, property, year, month, day, hour, minute, second, milliSecond)
    ccall((:DDC_SetChannelPropertyTimestampComponents, libddc), Cint, (DDCChannelHandle, Cstring, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, Cdouble), channel, property, year, month, day, hour, minute, second, milliSecond)
end

function DDC_GetChannelProperty(channel, property, value, valueSizeInBytes)
    ccall((:DDC_GetChannelProperty, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{Cvoid}, Csize_t), channel, property, value, valueSizeInBytes)
end

function DDC_GetChannelPropertyTimestampComponents(channel, property, year, month, day, hour, minute, second, milliSecond, weekDay)
    ccall((:DDC_GetChannelPropertyTimestampComponents, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{Cdouble}, Ptr{UInt32}), channel, property, year, month, day, hour, minute, second, milliSecond, weekDay)
end

function DDC_GetChannelStringPropertyLength(channel, property, length)
    ccall((:DDC_GetChannelStringPropertyLength, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{UInt32}), channel, property, length)
end

function DDC_CreateChannelPropertyTimestampComponents(channel, property, year, month, day, hour, minute, second, milliSecond)
    ccall((:DDC_CreateChannelPropertyTimestampComponents, libddc), Cint, (DDCChannelHandle, Cstring, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, Cdouble), channel, property, year, month, day, hour, minute, second, milliSecond)
end

function DDC_ChannelPropertyExists(channel, property, exists)
    ccall((:DDC_ChannelPropertyExists, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{Cint}), channel, property, exists)
end

function DDC_GetNumChannelProperties(channel, numProperties)
    ccall((:DDC_GetNumChannelProperties, libddc), Cint, (DDCChannelHandle, Ptr{UInt32}), channel, numProperties)
end

function DDC_GetChannelPropertyNames(channel, propertyNames, numPropertyNames)
    ccall((:DDC_GetChannelPropertyNames, libddc), Cint, (DDCChannelHandle, Ptr{Cstring}, Csize_t), channel, propertyNames, numPropertyNames)
end

function DDC_GetChannelPropertyType(channel, property, dataType)
    ccall((:DDC_GetChannelPropertyType, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{DDCDataType}), channel, property, dataType)
end

function DDC_GetLibraryErrorDescription(errorCode)
    ccall((:DDC_GetLibraryErrorDescription, libddc), Cstring, (Cint,), errorCode)
end

function DDC_FreeMemory(memoryPointer)
    ccall((:DDC_FreeMemory, libddc), Cvoid, (Ptr{Cvoid},), memoryPointer)
end

function DDC_SetDataValuesUInt8(channel, values, numValues)
    ccall((:DDC_SetDataValuesUInt8, libddc), Cint, (DDCChannelHandle, Ptr{Cuchar}, Csize_t), channel, values, numValues)
end

function DDC_SetDataValuesInt16(channel, values, numValues)
    ccall((:DDC_SetDataValuesInt16, libddc), Cint, (DDCChannelHandle, Ptr{Int16}, Csize_t), channel, values, numValues)
end

function DDC_SetDataValuesInt32(channel, values, numValues)
    ccall((:DDC_SetDataValuesInt32, libddc), Cint, (DDCChannelHandle, Ptr{Clong}, Csize_t), channel, values, numValues)
end

function DDC_SetDataValuesFloat(channel, values, numValues)
    ccall((:DDC_SetDataValuesFloat, libddc), Cint, (DDCChannelHandle, Ptr{Cfloat}, Csize_t), channel, values, numValues)
end

function DDC_SetDataValuesDouble(channel, values, numValues)
    ccall((:DDC_SetDataValuesDouble, libddc), Cint, (DDCChannelHandle, Ptr{Cdouble}, Csize_t), channel, values, numValues)
end

function DDC_SetDataValuesString(channel, values, numValues)
    ccall((:DDC_SetDataValuesString, libddc), Cint, (DDCChannelHandle, Ptr{Cstring}, Csize_t), channel, values, numValues)
end

function DDC_AppendDataValuesUInt8(channel, values, numValues)
    ccall((:DDC_AppendDataValuesUInt8, libddc), Cint, (DDCChannelHandle, Ptr{Cuchar}, Csize_t), channel, values, numValues)
end

function DDC_AppendDataValuesInt16(channel, values, numValues)
    ccall((:DDC_AppendDataValuesInt16, libddc), Cint, (DDCChannelHandle, Ptr{Int16}, Csize_t), channel, values, numValues)
end

function DDC_AppendDataValuesInt32(channel, values, numValues)
    ccall((:DDC_AppendDataValuesInt32, libddc), Cint, (DDCChannelHandle, Ptr{Clong}, Csize_t), channel, values, numValues)
end

function DDC_AppendDataValuesFloat(channel, values, numValues)
    ccall((:DDC_AppendDataValuesFloat, libddc), Cint, (DDCChannelHandle, Ptr{Cfloat}, Csize_t), channel, values, numValues)
end

function DDC_AppendDataValuesDouble(channel, values, numValues)
    ccall((:DDC_AppendDataValuesDouble, libddc), Cint, (DDCChannelHandle, Ptr{Cdouble}, Csize_t), channel, values, numValues)
end

function DDC_AppendDataValuesString(channel, values, numValues)
    ccall((:DDC_AppendDataValuesString, libddc), Cint, (DDCChannelHandle, Ptr{Cstring}, Csize_t), channel, values, numValues)
end

function DDC_ReplaceDataValuesUInt8(channel, indexOfFirstValueToReplace, values, numValues)
    ccall((:DDC_ReplaceDataValuesUInt8, libddc), Cint, (DDCChannelHandle, Csize_t, Ptr{Cuchar}, Csize_t), channel, indexOfFirstValueToReplace, values, numValues)
end

function DDC_ReplaceDataValuesInt16(channel, indexOfFirstValueToReplace, values, numValues)
    ccall((:DDC_ReplaceDataValuesInt16, libddc), Cint, (DDCChannelHandle, Csize_t, Ptr{Int16}, Csize_t), channel, indexOfFirstValueToReplace, values, numValues)
end

function DDC_ReplaceDataValuesInt32(channel, indexOfFirstValueToReplace, values, numValues)
    ccall((:DDC_ReplaceDataValuesInt32, libddc), Cint, (DDCChannelHandle, Csize_t, Ptr{Clong}, Csize_t), channel, indexOfFirstValueToReplace, values, numValues)
end

function DDC_ReplaceDataValuesFloat(channel, indexOfFirstValueToReplace, values, numValues)
    ccall((:DDC_ReplaceDataValuesFloat, libddc), Cint, (DDCChannelHandle, Csize_t, Ptr{Cfloat}, Csize_t), channel, indexOfFirstValueToReplace, values, numValues)
end

function DDC_ReplaceDataValuesDouble(channel, indexOfFirstValueToReplace, values, numValues)
    ccall((:DDC_ReplaceDataValuesDouble, libddc), Cint, (DDCChannelHandle, Csize_t, Ptr{Cdouble}, Csize_t), channel, indexOfFirstValueToReplace, values, numValues)
end

function DDC_ReplaceDataValuesString(channel, indexOfFirstValueToReplace, values, numValues)
    ccall((:DDC_ReplaceDataValuesString, libddc), Cint, (DDCChannelHandle, Csize_t, Ptr{Cstring}, Csize_t), channel, indexOfFirstValueToReplace, values, numValues)
end

function DDC_GetDataValuesUInt8(channel, indexOfFirstValueToGet, numValuesToGet, values)
    ccall((:DDC_GetDataValuesUInt8, libddc), Cint, (DDCChannelHandle, Csize_t, Csize_t, Ptr{Cuchar}), channel, indexOfFirstValueToGet, numValuesToGet, values)
end

function DDC_GetDataValuesInt16(channel, indexOfFirstValueToGet, numValuesToGet, values)
    ccall((:DDC_GetDataValuesInt16, libddc), Cint, (DDCChannelHandle, Csize_t, Csize_t, Ptr{Int16}), channel, indexOfFirstValueToGet, numValuesToGet, values)
end

function DDC_GetDataValuesInt32(channel, indexOfFirstValueToGet, numValuesToGet, values)
    ccall((:DDC_GetDataValuesInt32, libddc), Cint, (DDCChannelHandle, Csize_t, Csize_t, Ptr{Clong}), channel, indexOfFirstValueToGet, numValuesToGet, values)
end

function DDC_GetDataValuesFloat(channel, indexOfFirstValueToGet, numValuesToGet, values)
    ccall((:DDC_GetDataValuesFloat, libddc), Cint, (DDCChannelHandle, Csize_t, Csize_t, Ptr{Cfloat}), channel, indexOfFirstValueToGet, numValuesToGet, values)
end

function DDC_GetDataValuesDouble(channel, indexOfFirstValueToGet, numValuesToGet, values)
    ccall((:DDC_GetDataValuesDouble, libddc), Cint, (DDCChannelHandle, Csize_t, Csize_t, Ptr{Cdouble}), channel, indexOfFirstValueToGet, numValuesToGet, values)
end

function DDC_GetDataValuesString(channel, indexOfFirstValueToGet, numValuesToGet, values)
    ccall((:DDC_GetDataValuesString, libddc), Cint, (DDCChannelHandle, Csize_t, Csize_t, Ptr{Cstring}), channel, indexOfFirstValueToGet, numValuesToGet, values)
end

function DDC_CreateFilePropertyUInt8(file, property, value)
    ccall((:DDC_CreateFilePropertyUInt8, libddc), Cint, (DDCFileHandle, Cstring, Cuchar), file, property, value)
end

function DDC_CreateFilePropertyInt16(file, property, value)
    ccall((:DDC_CreateFilePropertyInt16, libddc), Cint, (DDCFileHandle, Cstring, Int16), file, property, value)
end

function DDC_CreateFilePropertyInt32(file, property, value)
    ccall((:DDC_CreateFilePropertyInt32, libddc), Cint, (DDCFileHandle, Cstring, Clong), file, property, value)
end

function DDC_CreateFilePropertyFloat(file, property, value)
    ccall((:DDC_CreateFilePropertyFloat, libddc), Cint, (DDCFileHandle, Cstring, Cfloat), file, property, value)
end

function DDC_CreateFilePropertyDouble(file, property, value)
    ccall((:DDC_CreateFilePropertyDouble, libddc), Cint, (DDCFileHandle, Cstring, Cdouble), file, property, value)
end

function DDC_CreateFilePropertyString(file, property, value)
    ccall((:DDC_CreateFilePropertyString, libddc), Cint, (DDCFileHandle, Cstring, Cstring), file, property, value)
end

function DDC_SetFilePropertyUInt8(file, property, value)
    ccall((:DDC_SetFilePropertyUInt8, libddc), Cint, (DDCFileHandle, Cstring, Cuchar), file, property, value)
end

function DDC_SetFilePropertyInt16(file, property, value)
    ccall((:DDC_SetFilePropertyInt16, libddc), Cint, (DDCFileHandle, Cstring, Int16), file, property, value)
end

function DDC_SetFilePropertyInt32(file, property, value)
    ccall((:DDC_SetFilePropertyInt32, libddc), Cint, (DDCFileHandle, Cstring, Clong), file, property, value)
end

function DDC_SetFilePropertyFloat(file, property, value)
    ccall((:DDC_SetFilePropertyFloat, libddc), Cint, (DDCFileHandle, Cstring, Cfloat), file, property, value)
end

function DDC_SetFilePropertyDouble(file, property, value)
    ccall((:DDC_SetFilePropertyDouble, libddc), Cint, (DDCFileHandle, Cstring, Cdouble), file, property, value)
end

function DDC_SetFilePropertyString(file, property, value)
    ccall((:DDC_SetFilePropertyString, libddc), Cint, (DDCFileHandle, Cstring, Cstring), file, property, value)
end

function DDC_GetFilePropertyUInt8(file, property, value)
    ccall((:DDC_GetFilePropertyUInt8, libddc), Cint, (DDCFileHandle, Cstring, Ptr{Cuchar}), file, property, value)
end

function DDC_GetFilePropertyInt16(file, property, value)
    ccall((:DDC_GetFilePropertyInt16, libddc), Cint, (DDCFileHandle, Cstring, Ptr{Int16}), file, property, value)
end

function DDC_GetFilePropertyInt32(file, property, value)
    ccall((:DDC_GetFilePropertyInt32, libddc), Cint, (DDCFileHandle, Cstring, Ptr{Clong}), file, property, value)
end

function DDC_GetFilePropertyFloat(file, property, value)
    ccall((:DDC_GetFilePropertyFloat, libddc), Cint, (DDCFileHandle, Cstring, Ptr{Cfloat}), file, property, value)
end

function DDC_GetFilePropertyDouble(file, property, value)
    ccall((:DDC_GetFilePropertyDouble, libddc), Cint, (DDCFileHandle, Cstring, Ptr{Cdouble}), file, property, value)
end

function DDC_GetFilePropertyString(file, property, value, valueSize)
    ccall((:DDC_GetFilePropertyString, libddc), Cint, (DDCFileHandle, Cstring, Ptr{UInt8}, Csize_t), file, property, value, valueSize)
end

function DDC_CreateChannelGroupPropertyUInt8(channelGroup, property, value)
    ccall((:DDC_CreateChannelGroupPropertyUInt8, libddc), Cint, (DDCChannelGroupHandle, Cstring, Cuchar), channelGroup, property, value)
end

function DDC_CreateChannelGroupPropertyInt16(channelGroup, property, value)
    ccall((:DDC_CreateChannelGroupPropertyInt16, libddc), Cint, (DDCChannelGroupHandle, Cstring, Int16), channelGroup, property, value)
end

function DDC_CreateChannelGroupPropertyInt32(channelGroup, property, value)
    ccall((:DDC_CreateChannelGroupPropertyInt32, libddc), Cint, (DDCChannelGroupHandle, Cstring, Clong), channelGroup, property, value)
end

function DDC_CreateChannelGroupPropertyFloat(channelGroup, property, value)
    ccall((:DDC_CreateChannelGroupPropertyFloat, libddc), Cint, (DDCChannelGroupHandle, Cstring, Cfloat), channelGroup, property, value)
end

function DDC_CreateChannelGroupPropertyDouble(channelGroup, property, value)
    ccall((:DDC_CreateChannelGroupPropertyDouble, libddc), Cint, (DDCChannelGroupHandle, Cstring, Cdouble), channelGroup, property, value)
end

function DDC_CreateChannelGroupPropertyString(channelGroup, property, value)
    ccall((:DDC_CreateChannelGroupPropertyString, libddc), Cint, (DDCChannelGroupHandle, Cstring, Cstring), channelGroup, property, value)
end

function DDC_SetChannelGroupPropertyUInt8(channelGroup, property, value)
    ccall((:DDC_SetChannelGroupPropertyUInt8, libddc), Cint, (DDCChannelGroupHandle, Cstring, Cuchar), channelGroup, property, value)
end

function DDC_SetChannelGroupPropertyInt16(channelGroup, property, value)
    ccall((:DDC_SetChannelGroupPropertyInt16, libddc), Cint, (DDCChannelGroupHandle, Cstring, Int16), channelGroup, property, value)
end

function DDC_SetChannelGroupPropertyInt32(channelGroup, property, value)
    ccall((:DDC_SetChannelGroupPropertyInt32, libddc), Cint, (DDCChannelGroupHandle, Cstring, Clong), channelGroup, property, value)
end

function DDC_SetChannelGroupPropertyFloat(channelGroup, property, value)
    ccall((:DDC_SetChannelGroupPropertyFloat, libddc), Cint, (DDCChannelGroupHandle, Cstring, Cfloat), channelGroup, property, value)
end

function DDC_SetChannelGroupPropertyDouble(channelGroup, property, value)
    ccall((:DDC_SetChannelGroupPropertyDouble, libddc), Cint, (DDCChannelGroupHandle, Cstring, Cdouble), channelGroup, property, value)
end

function DDC_SetChannelGroupPropertyString(channelGroup, property, value)
    ccall((:DDC_SetChannelGroupPropertyString, libddc), Cint, (DDCChannelGroupHandle, Cstring, Cstring), channelGroup, property, value)
end

function DDC_GetChannelGroupPropertyUInt8(channelGroup, property, value)
    ccall((:DDC_GetChannelGroupPropertyUInt8, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{Cuchar}), channelGroup, property, value)
end

function DDC_GetChannelGroupPropertyInt16(channelGroup, property, value)
    ccall((:DDC_GetChannelGroupPropertyInt16, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{Int16}), channelGroup, property, value)
end

function DDC_GetChannelGroupPropertyInt32(channelGroup, property, value)
    ccall((:DDC_GetChannelGroupPropertyInt32, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{Clong}), channelGroup, property, value)
end

function DDC_GetChannelGroupPropertyFloat(channelGroup, property, value)
    ccall((:DDC_GetChannelGroupPropertyFloat, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{Cfloat}), channelGroup, property, value)
end

function DDC_GetChannelGroupPropertyDouble(channelGroup, property, value)
    ccall((:DDC_GetChannelGroupPropertyDouble, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{Cdouble}), channelGroup, property, value)
end

function DDC_GetChannelGroupPropertyString(channelGroup, property, value, valueSize)
    ccall((:DDC_GetChannelGroupPropertyString, libddc), Cint, (DDCChannelGroupHandle, Cstring, Ptr{UInt8}, Csize_t), channelGroup, property, value, valueSize)
end

function DDC_CreateChannelPropertyUInt8(channel, property, value)
    ccall((:DDC_CreateChannelPropertyUInt8, libddc), Cint, (DDCChannelHandle, Cstring, Cuchar), channel, property, value)
end

function DDC_CreateChannelPropertyInt16(channel, property, value)
    ccall((:DDC_CreateChannelPropertyInt16, libddc), Cint, (DDCChannelHandle, Cstring, Int16), channel, property, value)
end

function DDC_CreateChannelPropertyInt32(channel, property, value)
    ccall((:DDC_CreateChannelPropertyInt32, libddc), Cint, (DDCChannelHandle, Cstring, Clong), channel, property, value)
end

function DDC_CreateChannelPropertyFloat(channel, property, value)
    ccall((:DDC_CreateChannelPropertyFloat, libddc), Cint, (DDCChannelHandle, Cstring, Cfloat), channel, property, value)
end

function DDC_CreateChannelPropertyDouble(channel, property, value)
    ccall((:DDC_CreateChannelPropertyDouble, libddc), Cint, (DDCChannelHandle, Cstring, Cdouble), channel, property, value)
end

function DDC_CreateChannelPropertyString(channel, property, value)
    ccall((:DDC_CreateChannelPropertyString, libddc), Cint, (DDCChannelHandle, Cstring, Cstring), channel, property, value)
end

function DDC_SetChannelPropertyUInt8(channel, property, value)
    ccall((:DDC_SetChannelPropertyUInt8, libddc), Cint, (DDCChannelHandle, Cstring, Cuchar), channel, property, value)
end

function DDC_SetChannelPropertyInt16(channel, property, value)
    ccall((:DDC_SetChannelPropertyInt16, libddc), Cint, (DDCChannelHandle, Cstring, Int16), channel, property, value)
end

function DDC_SetChannelPropertyInt32(channel, property, value)
    ccall((:DDC_SetChannelPropertyInt32, libddc), Cint, (DDCChannelHandle, Cstring, Clong), channel, property, value)
end

function DDC_SetChannelPropertyFloat(channel, property, value)
    ccall((:DDC_SetChannelPropertyFloat, libddc), Cint, (DDCChannelHandle, Cstring, Cfloat), channel, property, value)
end

function DDC_SetChannelPropertyDouble(channel, property, value)
    ccall((:DDC_SetChannelPropertyDouble, libddc), Cint, (DDCChannelHandle, Cstring, Cdouble), channel, property, value)
end

function DDC_SetChannelPropertyString(channel, property, value)
    ccall((:DDC_SetChannelPropertyString, libddc), Cint, (DDCChannelHandle, Cstring, Cstring), channel, property, value)
end

function DDC_GetChannelPropertyUInt8(channel, property, value)
    ccall((:DDC_GetChannelPropertyUInt8, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{Cuchar}), channel, property, value)
end

function DDC_GetChannelPropertyInt16(channel, property, value)
    ccall((:DDC_GetChannelPropertyInt16, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{Int16}), channel, property, value)
end

function DDC_GetChannelPropertyInt32(channel, property, value)
    ccall((:DDC_GetChannelPropertyInt32, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{Clong}), channel, property, value)
end

function DDC_GetChannelPropertyFloat(channel, property, value)
    ccall((:DDC_GetChannelPropertyFloat, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{Cfloat}), channel, property, value)
end

function DDC_GetChannelPropertyDouble(channel, property, value)
    ccall((:DDC_GetChannelPropertyDouble, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{Cdouble}), channel, property, value)
end

function DDC_GetChannelPropertyString(channel, property, value, valueSize)
    ccall((:DDC_GetChannelPropertyString, libddc), Cint, (DDCChannelHandle, Cstring, Ptr{UInt8}, Csize_t), channel, property, value, valueSize)
end

function DDC_GetFilePropertyNameFromIndex(file, index, propertyName, propertyNameSize)
    ccall((:DDC_GetFilePropertyNameFromIndex, libddc), Cint, (DDCFileHandle, Csize_t, Ptr{UInt8}, Csize_t), file, index, propertyName, propertyNameSize)
end

function DDC_GetFilePropertyNameLengthFromIndex(file, index, propertyNameLength)
    ccall((:DDC_GetFilePropertyNameLengthFromIndex, libddc), Cint, (DDCFileHandle, Csize_t, Ptr{Csize_t}), file, index, propertyNameLength)
end

function DDC_GetChannelGroupPropertyNameFromIndex(channelGroup, index, propertyName, propertyNameSize)
    ccall((:DDC_GetChannelGroupPropertyNameFromIndex, libddc), Cint, (DDCChannelGroupHandle, Csize_t, Ptr{UInt8}, Csize_t), channelGroup, index, propertyName, propertyNameSize)
end

function DDC_GetChannelGroupPropertyNameLengthFromIndex(channelGroup, index, propertyNameLength)
    ccall((:DDC_GetChannelGroupPropertyNameLengthFromIndex, libddc), Cint, (DDCChannelGroupHandle, Csize_t, Ptr{Csize_t}), channelGroup, index, propertyNameLength)
end

function DDC_GetChannelPropertyNameFromIndex(channel, index, propertyName, propertyNameSize)
    ccall((:DDC_GetChannelPropertyNameFromIndex, libddc), Cint, (DDCChannelHandle, Csize_t, Ptr{UInt8}, Csize_t), channel, index, propertyName, propertyNameSize)
end

function DDC_GetChannelPropertyNameLengthFromIndex(channel, index, propertyNameLength)
    ccall((:DDC_GetChannelPropertyNameLengthFromIndex, libddc), Cint, (DDCChannelHandle, Csize_t, Ptr{Csize_t}), channel, index, propertyNameLength)
end