[protobuf] PB string into another PB?

2009-10-21 Thread SuKai
Hi All! SerializeToString is used for translate PB object to std::string, but i want to use this string assign to another PB object's colum. I cannot to do it. a.proto message A { required string user = 1; } b.proto message B { required int counts = 1; } So, B.SerializeToString(

[protobuf] Java and Dynamic messages

2009-10-21 Thread TinCan
Hi, My problem: I am working on a Java application which is using protocol buffers to communicate with an application written in C++. I've met some challenges at the Java end, because I do not have the opportunity to compile the .proto files into my Java app. At the C++ end we did not encounter a

[protobuf] Segfault - ideas please!?

2009-10-21 Thread edan
I have a bizarre and not very reproducible segfault / core dump, that happens when my program exits. Here is the stack trace: #0 0xf7becf99 in __gnu_cxx::__exchange_and_add () from /usr/lib/libstdc++.so.6 #1 0xf7f1d7f0 in __gnu_cxx::hashtable, std::string, google::protobuf::hash, std::_Select1s

[protobuf] Re: PB string into another PB?

2009-10-21 Thread Henner Zeller
On Wed, Oct 21, 2009 at 01:11, SuKai wrote: > > Hi All! > > SerializeToString is used for translate PB object to std::string, but i > want to use this string assign to another PB object's colum. > > I cannot to do it. What exactly does not work ? What do you try to do and what do you expect but

[protobuf] cross compile blackfin: problems linking - pthreads

2009-10-21 Thread Rob
Hi, This is my build script to cross compile protobuf 2.2.0: #!/bin/sh FLAGS="--disable-shared --disable-crypto-auth --without-gnutls -- without-ssl --without-zlib \ --without-libssh2 --disable-ipv6 --disable-manual --disable-telnet --disable-tftp \ --disable-ldap --disa

[protobuf] Re: Java and Dynamic messages

2009-10-21 Thread Kenton Varda
There is no .proto parser in Java. However, you can use protoc's --descriptor_set_out flag to generate a FileDescriptorProto representing the file (or use FileDescriptor::CopyTo() in C++). This is a protocol buffer representation of everything defined in the .proto. In Java, you can then: 1) Par

[protobuf] Re: PB string into another PB?

2009-10-21 Thread Kenton Varda
First, change A.user to have the type "bytes" instead of "string". Then do this: b.SerializeToString(a.mutable_user()); But why not declare "user" to be of type A instead? Like: message A { required B user = 1; } On Wed, Oct 21, 2009 at 1:11 AM, SuKai wrote: > Hi All! > > SerializeToString

[protobuf] Re: cross compile blackfin: problems linking - pthreads

2009-10-21 Thread Kenton Varda
When you compile a program against libprotobuf, you need to use pkg-config to find out what additional cflags and libs are necessary. Example: g++ -c my_prog.cc `pkg-config --cflags protobuf` g++ -o my_prog my_prog.o `pkg-config --libs protobuf` Your specific problem is probably that you are

[protobuf] Re: Segfault - ideas please!?

2009-10-21 Thread Kenton Varda
It looks like you are calling exit() from a signal handler. Lots of stuff is not safe to do in signal handlers. You should perhaps use _exit() instead to bypass destruction of global variables. On Wed, Oct 21, 2009 at 6:04 AM, edan wrote: > I have a bizarre and not very reproducible segfault /

[protobuf] Re: cross compile blackfin: problems linking - pthreads

2009-10-21 Thread Rob
Hmm... not sure if my last msg got eaten or not, but the issue was specifying '-pthread' instead of '-lpthread'. Not sure why the protobuf requires this when nothing else does... but regardless, thanks for the pointer to pkg-config... it helped solve the problem for me! :) Thanks again! -Rob

[protobuf] Re: cross compile blackfin: problems linking - pthreads

2009-10-21 Thread Kenton Varda
It seems there's some ambiguity as to whether -pthread implies -lpthread. Are you able to compile and run the tests? On Wed, Oct 21, 2009 at 12:29 PM, Rob wrote: > > Hmm... not sure if my last msg got eaten or not, but the issue was > specifying '-pthread' instead of '-lpthread'. Not sure why

[protobuf] MASTER PSYCHIC READER~ ACCURATE & AMUSING

2009-10-21 Thread Fran Galton
Your first 3 minutes are FREE talking live with me. Please visit my website at: http://keen.com/Ask+Fran Or, call me right now at: 1-800-275-5336 x0160       --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[protobuf] Re: cross compile blackfin: problems linking - pthreads

2009-10-21 Thread Kenton Varda
>From your output, it appears that the tests are, in fact, crashing mid-run (hence "Abort"). You may want to run in a debugger and find out what is happening. But what I was expecting was that you wouldn't be able to compile the test in the first place due to the -pthread/-lpthread issue. I'm pre

[protobuf] Re: cross compile blackfin: problems linking - pthreads

2009-10-21 Thread Rob
Hi Kenton, I've crosscompiled the tests and ran them on the target board, here are the results... everything appears to have passed! I'm assuming some of those tests verify the threading (pthreads)? Is there anything else I should run? -Rob root:~> > ./protobuf-lite-test > PASS > And... >

[protobuf] Re: cross compile blackfin: problems linking - pthreads

2009-10-21 Thread Rob
Oh, I didn't even see the 'Abort'. It must be related to the uClinux's lack of 'fork()'. Maybe use 'vfork()' as a drop in replacement? http://docs.blackfin.uclinux.org/doku.php?id=living_without_forks Would you recommend sticking to the 'lite' interface? That test actually passed! On Wed, Oct

[protobuf] Re: cross compile blackfin: problems linking - pthreads

2009-10-21 Thread Rob
I just wanted to clarify to anyone who runs into this - I had to use '- pthread' because '-lpthread' did not work (linker flags) for my target (blackfin). On Oct 21, 12:29 pm, Rob wrote: > Hmm... not sure if my last msg got eaten or not, but the issue was > specifying '-pthread' instead of '-lpt

[protobuf] Re: cross compile blackfin: problems linking - pthreads

2009-10-21 Thread Kenton Varda
The lite test does not actually test all the features of the lite runtime. It only tests that the lite runtime works stand-alone. The full tests verify other features (many of which are shared between the two implementations). So you want to run the full tests. The problem you seem to have is ac

[protobuf] Re: PB string into another PB?

2009-10-21 Thread SuKai
Because A_instance.user stored with different type of PB. Fill A_instance.user with B, C, or D , these are diff PB objects. ok, i will try the follw method. Thanks! Kenton Varda 写道: > First, change A.user to have the type "bytes" instead of "string". > > Then do this: > > b.SerializeToString(a

[protobuf] Re: PB string into another PB?

2009-10-21 Thread SuKai
I will try . Instead of string with bytes. This PBs are RW may be on different language(C++ / Java/ Python). Henner Zeller 写道: > On Wed, Oct 21, 2009 at 01:11, SuKai wrote: > >> Hi All! >> >> SerializeToString is used for translate PB object to std::string, but i >> want to use this string

[protobuf] Re: PB string into another PB?

2009-10-21 Thread Kenton Varda
On Wed, Oct 21, 2009 at 6:04 PM, SuKai wrote: > Because A_instance.user stored with different type of PB. > > Fill A_instance.user with B, C, or D , these are diff PB objects. > Then you should have three different fields: message A { optional B user_b = 1; optional C user_c = 2; optional

[protobuf] Re: PB string into another PB?

2009-10-21 Thread SuKai
I release this proto at R1: message A { optional B user_b = 1; optional C user_c = 2; optional D user_d = 3; } but if I find some fault with this proto or extend this proto at R2: message A { optional B user_b = 1; optional C user_c = 2; optional E user_d = 3; optional F user_e = 4; } So , I wan

[protobuf] Re: PB string into another PB?

2009-10-21 Thread Kenton Varda
I don't quite understand your question. It's safe to add new fields to a protocol buffer. If you want to store all the values as one unit -- for instance, so that old releases that don't know about new fields still know that the fields represent the same "column" -- you could always wrap them in a

[protobuf] Re: PB string into another PB?

2009-10-21 Thread SuKai
I want to define my protocol with PB. So, first I define the protocol head. message head { requirement int command = 1; requeirment string mask = 2; ... and so on. optional Module_A ma = 10; optional Module_B mb = 11; ... and so on. } message Module_A { ... } message

[protobuf] Re: PB string into another PB?

2009-10-21 Thread SuKai
Now , I wrote like this. message head { requirement int command = 1; requeirment string mask = 2; ... and so on. optional bytes module = 10; } All these module PB objects SerializeToString() into head_instance's module column. It is ok , between C++ and Python. SuKai 写道: > I wan

[protobuf] Re: Segfault - ideas please!?

2009-10-21 Thread edan
I can try that - I actually thought exit() was safe to call from a signal handler - thanks for opening my eyes. But the interesting thing is that I can also see that my program was not in the middle of any protobuf-related stuff when it was interrupted by the signal handler - it was in a sleep. Th