X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/774037b15064dcc6e4995c0bba3b24abb1bde35f..e10d6e307623d0952f6e1f5d9fee8720ddab4808:/doc/gob.1.in?ds=sidebyside diff --git a/doc/gob.1.in b/doc/gob.1.in index be027ac..40916fd 100644 --- a/doc/gob.1.in +++ b/doc/gob.1.in @@ -43,6 +43,9 @@ Exit with an error only on errors, not on warnings, this is the default. .B --for-cpp Generate C++ code. .TP +.B --no-extern-c +Never add the extern "C" to the header. +.TP .B --no-gnu Never generate any code with GNU C extensions. However all the GNU C extensions are always wrapped in #ifdef __GNUC__, so code using them compiles @@ -98,11 +101,25 @@ you should only edit the .gob file. .SH INCLUDING NORMAL C CODE IN THE OUTPUT FILES .PP To include some code directly in the output C file begin with '%{' -on an empty line and end the code with a '%}' on an empty line. To -put the code in the output header file, start the code with a '%h{'. -For example: +on an empty line and end the code with a '%}' on an empty line. These +sections will appear in the output files in the order they are given. +There are several other \fIsections\fR to which you can put code. You can +put it in the 'header' section (which can be abbreviated 'h') and it will +go into the public header file. You can also put it in the 'privateheader' +section (abbreviated 'ph') which will make the code go into the private +header file. Sometimes you want some code (other includes) to appear before +the extern "C" and the protecting define. To do this you can put them +into the 'headertop' (or 'ht') section. For example: .nf + %headertop{ + /* this will be on top of the public header */ + %} + + %privateheader{ + /* this will go into the private header file */ + %} + %h{ /* will be included in the header */ void somefunc(int i); @@ -531,6 +548,31 @@ argument lists and virtual and signal method names as it might confuse the PARENT_HANDLER macro. In fact avoiding all names with three underscores is the best policy when working with gob. +.SH DEALING WITH CIRCULAR HEADERS +.PP +Sometimes you may need to use an object of type MyObjectA in the MyObjectB +class and vice versa. Obviously you can't include headers for both. So you +need to just declare the typedef in the header of A for B, and the other way +around as well. The headers generated since v0.92.2 include a protecting +define before it declares the typedef. This define is the +__TYPEDEF___. So inside my-object-a.h there will be +this: +.nf + + #ifndef __TYPEDEF_MY_OBJECT_A__ + #define __TYPEDEF_MY_OBJECT_A__ + typedef struct _MyObjectA MyObjectA; + #endif + +.fi +Now instead of including my-object-a.h in the header section of +my-object-b.gob, just copy the above code there and you're set for using +MyObjectA as a type in the method parameters and public types. +.PP +Another way to get out of this problem is if you can use those types only +in the private members, in which case they won't be in the generated public +header. + .SH BUGS .PP Also the lexer does not actually parse the C code, so I'm sure that some corner