Igor
Could you document this part of NB?
Write one page on your old blog so that after we can turn it into a real
doc.
Stef
On 15/11/14 22:28, Igor Stasenko wrote:
On 15 November 2014 15:53, Max Leske <[email protected]
<mailto:[email protected]>> wrote:
Once again I’m struggling with NativeBoost. I’m trying to use
optCoerceNilToNull with this function:
^self call: #(LGitReturnCodeEnum git_commit_create(
LGitId * theCommitId,
LGitRepository repo,
String update_ref,
LGitSignature * theAuthor,
LGitSignature * theCommitter,
String message_encoding,
String theMessage,
LGitTree theTree,
int parent_count,
LGitCommit * parentsPointer)) options: #( optCoerceNilToNull )
The last argument can be NULL, per documentation, (no parents).
LGitCommit is a subclass of NBExternalObject and apparently
NBExternalObjctType>>pushAsPointer: does *not* use the
optCoerceNilToNull option (the super implementation in
NBExternalType>>pushAsPointer: however does). The upshot of course
is that the call fails with “an instance of LGitCommit expected”.
My questions:
- The documentation says:
"#optCoerceNilToNull"
"passing nil as a pointer-type argument, converts it to C NULL “
but apparently this doesn’t apply to every pointer type. Should
the documentation be updated?
- Why does NBExternlObjectType not use optCoerceNilToNull? I don’t
want to use tricks to pass null if I don’t have to.
perhaps because it is not there? :)
So, lets add it.
- Related: there are instances where even non-pointer arguments
are allowed to be NULL. Why does optCoerceNilToNull only work for
pointer types?
like what? Suppose the argument type is a structure, e.g
"struct foo bar", that is non-pointer type. What in this case the NULL
value for the structure?
Igor! Help! :)
Cheers,
Max
--
Best regards,
Igor Stasenko.