[Gambas-user] shared librarry into gambas

Doriano Blengino doriano.blengino at ...1909...
Thu Apr 9 23:31:03 CEST 2009


M0E Lnx ha scritto:
> Huh!.
>
> I wouldn't be surprised at all if your arguments are true, but for
> someone like myself, I feel that the documentation on this subject very
> limited. I will try to look at some examples.
>
> I need to access the libparted library, in the mean time, if you want
> to work up a sample for me that accesses the library, that would be
> swell! ;)
>   
Well, it took half an hour to install libparted and write some code. No 
documentation about this lib: ldap was well documented instead.

I attach a sample project which calls just three libparted functions; I 
had to consult the include files.
It is not so simple, but hey! You want to fiddle with not-so-easy things...

The big problem is with strings - I don't know why gambas strings don't 
map exactly to char* in C, but there must be good reasons (well I readed 
something about, but can remember well). You can pass gambas string 
straightforward to C char*, but you can't do the inverse.

Anyway, in the attached project you can see two or three useful things: 
how to declare external calls, how to read C strings, and how to cope 
with pointers to structures. I suspect the structure must be freed, but 
I didn't have the lust to read all the .h about parted... :-)

The project simply tries to open /dev/hda, hdb, hdc and hdd. Perhaps you 
have these newer SATA disks... if so, you have to change the source.

Have fun; if I can help I will try - but I don't want to read all that 
libparted documentation (well, *no* docs, only C include files...)

Regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Parted-0.0.1.tar.gz
Type: application/x-tgz
Size: 8002 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20090409/63935314/attachment.bin>


More information about the User mailing list