11 May 2003 cortezcarlos   » (Journeyer)

Sorry for the personal problems' log. Well, being back to the interesant problems, I'm working on a P/Invoke article for the Linux Gazette, which let the developers extend their code in C and Perl languages ( at this moment ) and expose it to the Mono world ( Mono languages ).

It is very useful, because, for example, it made possible to bind the Gtk+ api to the Mono platform, so, we now have Gtk#, a great help for the future Gtk+ development.

But I'm having some problems with the datatype, cause sometimes the environment tries the float types as int, and it is not so good. Also, I got some problem while trying to work with C pointers. I've read a moment ago, there are apointers in C#, but they are unsafe ( I would really like to avoid use them but ... ).

I hope to finish my article the next monday or tuesday. By the way, here is a example, which shows the way P/Invoke works: we use DllImport attribute ( attributes are a way of asociate data with the data inside the application ), and loading a function from the math library ( libm.so ) :

[DllImport("libc.so")]
static extern double sqrt ( double n );

It is neccesary the use of the extern and static modifiers to the function signature.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!