When including a file, you need to refer to the types contained using
the filename as a prefix.
include "file1.thrift"
struct MyThing {
1: file1.SharedThing blah
}
The "namespace" keyword applies only to generated code, not to
references within the Thrift files (which allows you to use different
namespaces in different programming languages, when conventions differ,
etc.)
Cheers,
mcslee
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, October 20, 2008 1:53 PM
To: [email protected]
Subject: typedef / namespace / Win32 questions
Hello All
Got some thrift questions that I cant seem to find in documentation or
any examples:
Im using 2 separate thrift files and I seem to be having problems with
structs and typedefs.
I assume typedefs and structs can be imported via the include command?
Can typedefs be used on structs?
what about if a type def is in 2 seperate namespaces? Is there a
qualifier/scope to put in front (ie namespace1.typedef1)?
when I try the following:
======== FILE1 =============
namespace csharp test
struct SharedStruct {
1: i32 key
2: string value
}
typedef SharedStruct MyType1 //gives error (then i comment it out and I
expect setData1 to work below, but it also errors)
======== FILE2 =============
include "file1.thrift"
namespace csharp test2
service service1 {
void setData1(1:SharedStruct data) //gives error void
setData2(1:MyType1 data) }
Is "namespace * mynamespace" supposed to work? I can only get
"namespace csharp mynamespace" to work.
I've built the thrift compiler under cygwin using the release from
20080411
is there any reason why a win32 build can't be distributed? It seems
once a build is made, just copying thrift.exe and a cygwin.dll will make
it run on any computer.
Id imagine more C# users would use thrift if they just had the compiler
built since the C# library runs pretty straight forward
--
-Anthony