Re: [Vala] Type.from_name is returning null pointer
- From: "Fabian Deutsch" <fabian deutsch gmx de>
- To: "Peter" <peter5001 gmx de>,"Vala List" <vala-list gnome org>
- Subject: Re: [Vala] Type.from_name is returning null pointer
- Date: Wed, 29 Sep 2010 19:07:30 +0200
hello.
however, if i run the following sample code ...
public class MyObject:Object{}
void main () {
Type typeFromName = Type.from_name("MyObject");
print("%s\n", typeFromName.to_string());
print("%s\n", typeFromName.name());
}
... i get the following output:
0
(null)
... which i obviously cannot use to create any object.
i discovered that the code above works, but only if an object of
MyObject was previously created or if i previously used typeof(MyObject)
and assigned that type-object to some variable.
This is, because types are registered only on the first use and not before.
If you compile that code and look at the generated c-code, you see that the type is registered only when
creating an instance.
- fabian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]