Re: [Vala] Copy function produces segmentation fault

On Wed, May 18, 2011 at 3:21 AM, Luca Bruno <lethalman88 gmail com> wrote:

On Tue, May 17, 2011 at 01:55:57PM -0600, Lewis Gunsch wrote:

I have been writing a Vapi for the ZeroMQ library: I
would eventually like it to be distributed with Vala itself, and would
propose myself as the maintainer.

See the vapi here:

Would you add a link to ?

Done. I added the link to the bottom of the list.

 > Although, I am having some trouble getting the MSG.Msg.copy() message
function to work correctly. It produces a segmentation fault. I am unsure
how to go about fixing this issue. You can see the docs for the libraries
copy function below.

Try with:
[CCode (instance_pos = 2)]
public int copy (out Msg dest);

Use as:
Msg copy;
int res = somemsg.copy (out copy);

After digging around, I found out that a message has to be initialized
before copying. Because it has to be initialized, I can't use the out
parameter, but it looks like the ref parameter would make sense here.

[CCode (instance_pos = 2)]
public int copy(ref Msg dest);

Used as:
Msg copy = MSG.Msg ();
int res =  msg.copy (ref copy);


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