I might be missing some basic understanding on how Ptr
works, but how am I supposed to use a Ptr
argument as IN/OUT parameter under these conditions?
The function call is this:
conn_handle_ref = Ref{Ptr{Cvoid}}()
ora_common_params = OraCommonCreateParams(ctx, common_params)
ora_conn_create_params = OraConnCreateParams(ctx, conn_create_params)
result = dpiConn_create(ctx.handle, user, password, connect_string, Ref(ora_common_params), Ref(ora_conn_create_params), conn_handle_ref)
error_check(ctx, result)
my_new_connection = Connection(ctx, conn_handle_ref[], conn_create_params.pool)
Where
function dpiConn_create(context_handle::Ptr{Cvoid}, user::String, password::String, connect_string::String, common_params_ref::Ref{OraCommonCreateParams}, conn_create_params_ref::Ref{OraConnCreateParams}, dpi_conn_handle_ref::Ref{Ptr{Cvoid}})
userNameLength = sizeof(user)
passwordLength = sizeof(password)
connectStringLength = sizeof(connect_string)
ccall((:dpiConn_create, libdpi), OraResult, (Ptr{Cvoid}, Ptr{UInt8}, UInt32, Ptr{UInt8}, UInt32, Ptr{UInt8}, UInt32, Ref{OraCommonCreateParams}, Ref{OraConnCreateParams}, Ref{Ptr{Cvoid}}), context_handle, user, userNameLength, password, passwordLength, connect_string, connectStringLength, common_params_ref, conn_create_params_ref, dpi_conn_handle_ref)
end
and the C function definition is
int dpiConn_create(const dpiContext *context, const char *userName, uint32_t userNameLength, const char *password, uint32_t passwordLength, const char *connectString, uint32_t connectStringLength, dpiCommonCreateParams *commonParams, dpiConnCreateParams *createParams, dpiConn **conn)