Hi Stefan,

I've just committed a little modification to TalkFFI to automatically generate subclasses of NBExternalObject for definitions like:
typedef struct my_struct my_struct_t;
void fct(my_struct_t *inArg)

the ffi call is
void fct(MyStructTPtr inArg).

This gives us type-checking and simplifies the usage pattern, that u have presented, to:�
|headHandle path repo name|

repo := �LG2GitRepositoryPtr �new.
path := NBExternalAddress fromString: '/Users/ciprian/github/local/enso'.
LG2RepositoryH �uniqueInstance repository_open: �repo path: path.

headHandle := �LG2GitReferencePtr new.
LG2RepositoryH uniqueInstance repository_head: headHandle repo: repo.

name := LG2RefsH uniqueInstance reference_name: headHandle.
name readString.

Cheers,


On Fri, Jan 25, 2013 at 9:45 PM, Stefan Marr <smalltalk@stefan-marr.de> wrote:
Hi Ciprian:

On 25 Jan 2013, at 20:58, Ciprian Teodorov wrote:

> repo := �NBExternalObject new.
[...]

> repository_open: out path: path
> � � � ^self call: #(NBInt32 git_repository_open(NBExternalObject * out, NBCharacterType * path)) options: #( �)


> Notice that when using NBExternalObject one level of indirection is gone so git_repository ** becomes NBExternalObject *

Indeed, much nicer.

I am now using type aliases such as:
#(git_repository_ptr NBExternalObject
� git_reference_ptr �NBExternalObject)

With a signature such as:
^self call: #(int git_repository_open(git_repository_ptr * handle, char * path))

That stays close to the C, and tells me what the pointer are.

And with the NBExternalObject it works nicely.

Thanks a lot!
Stefan


--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax: � +32 2 629 3525





--
Dr. Ciprian TEODOROV
Ing
nieur�D�veloppement�CAO

t�l : 06 08 54 73 48

mail :�ciprian.teodorov@gmail.com
www.teodorov.ro