Discussion:
invoke fail when i use TVarVar.inout() as a parameter
zhi lee
2008-09-19 03:05:10 UTC
Permalink
the idl file is defined as follows:

//start
typedef sequence<octet> FILE;
struct FILE_INFO
{
FILE file;
long readsize;
};
boolean LoadFile( ..., inout FILE_INFO file );
//end

i used FILE_INFO_var to deliver and get the context of a file.
but when i called the function LoadFild(...), it failed at the client point.
and when i debug and trace where it failed, i found it throwed an exception
when corba called invoke.

but when i defined idl as follows and use TVarVar.out(), it works well.
//start
typedef sequence<octet> FILE;
struct FILE_INFO
{
FILE file;
long readsize;
};
boolean LoadFile( ..., inout FILE_INFO file );
//end


I don't know why, and hope someone can help me to solve this problem.


note: the main purpose of this function is to load file from a server
zhi lee
2008-09-19 03:08:03 UTC
Permalink
I made a mistake in the last mail
it should be "boolean LoadFile( ..., out FILE_INFO file );" in the second
idl file
Post by zhi lee
//start
typedef sequence<octet> FILE;
struct FILE_INFO
{
FILE file;
long readsize;
};
boolean LoadFile( ..., inout FILE_INFO file );
//end
i used FILE_INFO_var to deliver and get the context of a file.
but when i called the function LoadFild(...), it failed at the client point.
and when i debug and trace where it failed, i found it throwed an exception
when corba called invoke.
but when i defined idl as follows and use TVarVar.out(), it works well.
//start
typedef sequence<octet> FILE;
struct FILE_INFO
{
FILE file;
long readsize;
};
boolean LoadFile( ..., inout FILE_INFO file );
//end
I don't know why, and hope someone can help me to solve this problem.
note: the main purpose of this function is to load file from a server
Robert F. Gunion
2008-09-19 14:32:50 UTC
Permalink
How are you using the FILE_INFO_var on the client side? I suspect
you're doing something like:
FILE_INFO_var fi;
LoadFile(fi);

.. which will fail with the inout parameter because the _var contains a
null pointer. Instead, it should be:
FILE_INFO_var fi = new FILE_INFO;
LoadFile(fi);

Hope that helps.

p.s. If I'm interpreting your idl correctly, you don't need FILE_INFO
because, rather than sending the readsize separately you could use the
length() method of the FILE sequence var type. Then again, I don't
really know what you're using readsize for.
Post by zhi lee
I made a mistake in the last mail
it should be "boolean LoadFile( ..., out FILE_INFO file );" in the
second idl file
//start
typedef sequence<octet> FILE;
struct FILE_INFO
{
FILE file;
long readsize;
};
boolean LoadFile( ..., inout FILE_INFO file );
//end
i used FILE_INFO_var to deliver and get the context of a file.
but when i called the function LoadFild(...), it failed at the client point.
and when i debug and trace where it failed, i found it throwed an
exception when corba called invoke.
but when i defined idl as follows and use TVarVar.out(), it works well.
//start
typedef sequence<octet> FILE;
struct FILE_INFO
{
FILE file;
long readsize;
};
boolean LoadFile( ..., inout FILE_INFO file );
//end
I don't know why, and hope someone can help me to solve this problem.
note: the main purpose of this function is to load file from a server
------------------------------------------------------------------------
_______________________________________________
Mico-devel mailing list
http://www.mico.org/mailman/listinfo/mico-devel
Loading...