Talk:Vala (programming language): Difference between revisions

Content deleted Content added
Kiamlaluno (talk | contribs)
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Line 14:
 
If it should be as simple as possible, we should use something like this:
<sourcesyntaxhighlight lang="csharp">
using GLib;
 
Line 20:
print ("Hello World\n");
}
</syntaxhighlight>
</source>
However, it would be useful to have a second example, then, that shows a bit more of the syntax.
[[User:Juergbi|Juergbi]] ([[User talk:Juergbi|talk]]) 14:14, 22 June 2008 (UTC)
 
::If it were to be as simple as possible you could drop the glib import and just have the one-liner:
<blockquote><blockquote><sourcesyntaxhighlight lang="csharp">
void main() { print("Hello World\n"); }
</sourcesyntaxhighlight></blockquote></blockquote>
 
::[[Special:Contributions/24.243.3.27|24.243.3.27]] ([[User talk:24.243.3.27|talk]]) 09:53, 19 October 2008 (UTC)
Line 64:
:Ps. As an example of how easy it is to wrap C libraries, one can copy the default glib-2.0.vapi somewhere and edit it to wrap g_chdir by putting the following code under the DirUtils namespace, then compiling with the switch --vapidir=/path/to/modified/vapi:
 
<blockquote><sourcesyntaxhighlight lang="csharp">
[CCode (cname = "g_chdir")]
public static int chdir (string pathname);
</sourcesyntaxhighlight></blockquote>
 
:Which then be used from Vala code:
 
<blockquote><sourcesyntaxhighlight lang="csharp">
DirUtils.chdir( "/foo/bar" );
</sourcesyntaxhighlight></blockquote>
 
:[[Special:Contributions/24.243.3.27|24.243.3.27]] ([[User talk:24.243.3.27|talk]]) 08:00, 22 September 2008 (UTC)