Re: Howto build protobuf not as library, but directly linking object files?
On Jul 9, 8:54 pm, Alex Black a...@alexblack.ca wrote: Hey Bart, I'm not sure I'm seeing the full details of your situation, But on windows I compiled a library libprotobuf.lib, and linked to it statically, meaning it gets built into the exe (or dll) you're building. (I built 2 actually, a release one and a debug one). That's how it works on Linux. Here's the problems we're having on Windows. We're building protoc with the mingw compiler system included in the Qt 4.5.1 SDK. This doesn't generate .lib files, but .la files and .a files. The .a is a static archive. When I run 'nm libprotobuf.a' I get all the typical protobuf function definitions, so that looks ok. However, when I try to build my application with -Lpath/to/ libprotobuf.a I get hundreds of linker errors, complaining about undefined references to any of the google protocol functions. I'm using the same mingw compiler to build my Qt application, so that is not the problem. Anyway, I'm still struggling with this stuff, and since no one at my company knows anything about C++ on Windows, it's a hassle. So that's why I just try to circumvent the problem by just linking the object files directly. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: Howto build protobuf not as library, but directly linking object files?
Thank you thank you thank you! You're my savior :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: generating proto documentation
I'm thinking of writing some scripting stuff, convert 'message' to 'struct' and stuff like that, and see how far I'll get with converting proto files into some sort of pseudo-c. I think I'll mogrify the 'optional' and 'required' and 'repeated' flags to some custom doxygen tags. As soon as I have something, I'll put it on github as an opensource project. On Mar 17, 10:49 am, Mark Assad mas...@gmail.com wrote: HI, I have a bad solution. What I've been doing has been generating the .cc/.h files, and then using doxygen to document those classes. You can document C++ classes from files other than the header files that define the classes. It's messy, error prone, and you end up with a lot of extra methods document that you really don't want. In summary, I'd suggest doing it another way. The detailed message documentation is lost in a sea of undocumented methods. In the past, I have started working on patching doxygen to read and parse .proto files. I didn't get as far as I would have liked. I also looked at using the compiler/parser that is part of the protobuf source code, but that strips out the comments. My other thought was to use a custom option for the comment string. Then writer a Python script that read in the descriptor proto file, and generated documentation from that. The other thought I had was to patch the C++ code generator class to generate comments in the source files in the doxygen format, but I didn't want to tie the code generator to a documentation format. I still think the best option would be to update doxygen to support reading the .proto files, but it is also the most work (maybe not in the long term). Mark On Tue, Mar 17, 2009 at 8:28 PM, bart van deenen bart.vandee...@gmail.comwrote: Hi all How do you document .proto files? I'd love to really define our protocol with javadoc/qtdoc/doxygen tags inside the .proto files, and generate html documentation from that. Does anyone already have a solution, or something in the works that we can improve on? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Inheriting from generated C++ classes for adding Qt QString accessors. Problems expected?
Hi all I'd like to add some Qt specific addditions to some generated gpb classes, but I note the warning on the first C++ page of the documentation: You should not create your own Foo subclasses. If you subclass this class and override a virtual method, the override may be ignored, as many generated method calls are de-virtualized to improve performance. I should be fine as long as I don't use any of the already defined member names shouldn't I? Bart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Is it possible to delete one item of a 'repeated' message field (in Python)
I'm building a generic gpb editor, that can create gpb encoded files. The UI is completely dynamic, based on the .proto files that one chooses (http://github.com/bvdeenen/gpbedit/tree/master) In this editor I'm currently generating a gpb object on the fly, but since it's a gui editor, it is necessary to delete one item anywhere in a range of 'repeated' items. Is this currently possible with the python interface (ClearField removes all items of a repeated field)? Or should I hack around it, or maybe have a separate data representation and only build the gpb object when I'm done editting. (That's probably the easiest). Thanks Bart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Problem with dynamic __import__ of gpb modules
Hi I'm building a generic editor for creating loading and saving gpb objects and am running into problems with dynamic __import__ statements. I've nailed it down to a very simple testcase. This is all with python 2.5.2 and protobuf 2.0.3 on Linux. test.proto: message test {optional int32 x=1; } C.py: class K: def __init__(self): print new K import test_pb2, C a=getattr(test_pb2,test) a class 'test_pb2.test' b=getattr(C,K) b class C.K at 0xb64ceddc Why is one of the classnames in quotes, and the other not? When I try a dynamic import I've narrowed my problem down to : #!/usr/bin/python def test(): for module,klass in [('test_pb2','test'), ('C', 'K')]: m=__import__(module) k=getattr(m, klass) print *, m, k, type(k) print k() test() Which when run gives me the following * module 'test_pb2' from 'gpbedit/test_pb2.pyc' class 'test_pb2.test' class 'google.protobuf.reflection.GeneratedProtocolMessageType' new k= * module 'C' from '...gpbedit/C.pyc' C.K type 'classobj' new k= new K C.K instance at 0xb7d2764c When I try to create a protocol object of the 'test' type, my python script returns None. So where does this go wrong? Bart P.S. the editor is at http://github.com/bvdeenen/gpbedit/tree/master. It's still alpha quality, but it is capable of editing proto objects and generating a gui from proto files --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: solution for python and unicode string already found
Hi Kenton Here's the details: kubu:~$ protoc --version libprotoc 2.0.3 kubu:~$ python -V Python 2.5.2 This is a self-compiled protoc (because I had added the actionscript output generator). I actually find in CHANGES.txt for 2.0.2 that the Strings now use the unicode type rather than the str type. I'd really like it if this was resolved, and I'm quite willing to help any way I can. Here's the testcase again. Bart. kubu:~/testcase$ ./test.py Traceback (most recent call last): File ./test.py, line 18, in module T.s=ustring # FAILS File build/bdist.linux-i686/egg/google/protobuf/reflection.py, line 381, in setter File build/bdist.linux-i686/egg/google/protobuf/internal/ type_checkers.py, line 59, in CheckValue TypeError: u'\u0634\u0627\u0647\u062f\u0629 \u0628\u062b' has type type 'unicode', but expected one of: (type 'str',) kubu:~/testcase$ cat test.py #!/usr/bin/ python # -*- coding: utf-8 -*- from example_pb2 import * # example.proto # message test { # required string s=1; # } ustring = uشاهدة بث T = test() T.s=ustring # FAILS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: solution for python and unicode string already found
Oops found it already :-) T.s=ustring.encode('utf-8') and for getting it out ustring2 = T.s.decode('utf-8') Bart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: solution for python and unicode string already found
On Jan 28, 7:50 pm, Kenton Varda ken...@google.com wrote: What version of protocol buffers are you using? I believe we added unicode support to Python protobufs in 2.0.1 or 2.0.2, in which case you shouldn't need to manually encode/decode. It's 2.0.3 I'm not at work right now, but will check the python version (it's 2.5 or 2.6) I'm happy to help track this issue, I've compiled protoc earlier when I needed actionscript support. I think I'm currently using the default from ubuntu, but let me check tomorrow. Thanks Bart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
problem with python and unicode string
Hi all I'm using the python generated code to create a generic gpb object editor, and I've run into unicode issues. Here's a small example for the protofile example.proto # example.proto message test { required string s=1; } #!/usr/bin/python # -*- coding: utf-8 -*- from PyQt4.QtGui import * from example_pb2 import * from google.protobuf import text_format ustring = uﺵﺎﻫﺩﺓ ﺐﺛ astring = hello T = test() T.s=astring # str(ustring) # T.s=ustring # FAILS #print text_format.MessageToString(T) # the stuff below here is to see that i have no other encoding issues. The QLabel correctly # shows the same characters as the original string app = QApplication([]) l = QLabel() l.setText(ustring) l.show() app.exec_() Using the unicode string (T.s = ustring) fails with TypeError: u'\u0634\u0627\u0647\u062f\u0629 \u0628\u062b' has type type 'unicode', but expected one of: (type 'str',) How do I get my unicode data into my message? I can't coerce my unicode into type 'str' I think. Bart P.S. the gpb object editor I'm building is open source and can be got from http://github.com/bvdeenen/gpbedit/tree/master P.P.S I have no idea what the unicode means, it's from an Al Arabya headline. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---