[Vala] Allocate memory for a struct pointer



Hi,
I'm quite new and have a problem to initialize a struct. In the
tutorial and faq there are ways, but I think I have to manage the
memory manually in order to use libxml.

When I try:
  SAXHandler* handler = SAXHandler () { startElement = start_element };

I get:
  error: Assignment: Cannot convert from `Xml.SAXHandler' to
`Xml.SAXHandler*'

and when I try:
  SAXHandler* handler = new SAXHandler ();

I get:
  warning: deprecated syntax, don't use `new' to initialize structs
  error: Assignment: Cannot convert from `Xml.SAXHandler' to
`Xml.SAXHandler*'

or:
  SAXHandler* handler = SAXHandler* ();
I get:
  error: tuples are not supported

When I don't use manually allocation, I'll get:
*** glibc detected *** ./src/app: double free or corruption (out):
0x09bc7838 ***

I've tried to find some information about my problem but
without success sorry. I'm using vala 0.15.0 if that matters.

Best regards
Guenther



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]