-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
47 lines (36 loc) · 1.49 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
This is protobuf-perlxs, a Perl/XS code generator for Google's Protocol
Buffers. The generated Perl/XS code is meant to be compiled and linked
with the generated C++ code, and it provides the Perl developer with a
high performance interface to Protocol Buffer objects.
Each top-level message generates a Perl module, an XS source file, and
a typemap. Each top-level enum generates a Perl module and an XS
source file. No typemap is needed for a top-level enum.
If the .proto file specifies a package name, the package name is
converted to a Perl package prefix like so:
file.proto
---------------------------
package foo.bar.baz;
message qux {
...
}
becomes (in Perl):
Qux.pm
---------------------------
package Foo::Bar::Baz::Qux;
Qux.xs
---------------------------
#include "file.pb.h"
MODULE = Foo::Bar::Baz::Qux PACKAGE = Foo::Bar::Baz::Qux
PROTOTYPES: ENABLE
qux.typemap
---------------------------
::foo::bar::baz::qux * T_FOO_BAR_BAZ_QUX
The Perl/XS code generator assumes that the C++ code generator will
have been run on the same .proto files by the time the sources are to
be compiled. It is possible to build a Makefile.PL that compiles the
generated C++ sources along with the generated XS sources, and it is
also possible (preferable, in fact) to compile the C++ sources into a
shared library separately, linking the compiled XS sources with this
shared library. In both scenarios, the generated C++ headers need to
be present in the include path, as they are included by the XS source
files.