Hi Tobias,

model = SQBMatrixTrain( featureMatrix, labelVector, maxIters, options )

That is how the matlab call looks like, so it is very transparent.
That is how I want the Julia call look like, and I think that it is better
to pass Julia objects directly to ccall() in those cases.

It also offers more freedom for C/C++ programmers. I have some code already
working, and to me it looks neater than
creating new function calls to pass/return array sizes/etc, and added to
that my fear to mis-matched structs between C and Julia.

For example, with what I have now working in C++, to create a struct of
type MyStruct from a module,
with members *str2, str1 *and *num*, one does:

extern "C" {
void * createStructTest( void *module )
{
JL::Struct::Type s = JL::Struct::create( module, "MyStruct" );
JL::Struct::setField( s, "str2", "This is str2" );
 JL::Struct::setField( s, "num", (int64_t)1234 );
        JL::Struct::setField( s, "str2", "another string" );

 return s;
}
}

and it automatically checks that MyStruct is a valid type, that str2 is a
member and it is a string,
that num is a member and is a int64, etc. If  not, it throws a Julia
exception and ends cleanly.

As I said before, I think this could help Julia newcomers when wrapping
their C/C++ libraries.

Thanks.


------------------------------------------
Carlos


On Mon, Feb 10, 2014 at 5:20 PM, Tobias Knopp
<tobias.kn...@googlemail.com>wrote:

>
> Am Montag, 10. Februar 2014 14:17:02 UTC+1 schrieb Carlos Becker:
>
>>
>> model = SQBMatrixTrain( featureMatrix, labelVector, maxIters, options )
>>
>
> Is this the function declaration of the C function or is this how you want
> your Julia API to look like?
> If its the C signature and model is a pointer to an array of structs, this
> function cannot be used at all as the user cannot know the length of model.
> Note, by the way that the length/size of an array is not a compile time
> parameter. It can be changed during runtime.
>
>
>

Reply via email to