Dear Neale, Since the beginning of time, we've been running .api files through the C preprocessor. Put all of your "typeonly..." definitions in a file, and #include it. Should work immediately.
Thanks to Damjan, there's only one copy of the suffix rule, in .../src/suffix-rules.mk. Here's the relevant rule: %.api.h: %.api @VPPAPIGEN@ @echo " APIGEN " $@ ; \ mkdir -p `dirname $@` ; \ $(CC) $(CPPFLAGS) -E -P -C -x c $< \ | @VPPAPIGEN@ --input - --output $@ --show-name $@ > /dev/null HTH… Dave -----Original Message----- From: vpp-dev-boun...@lists.fd.io [mailto:vpp-dev-boun...@lists.fd.io] On Behalf Of Neale Ranns (nranns) Sent: Monday, November 20, 2017 3:28 AM To: vpp-dev@lists.fd.io Subject: [vpp-dev] RFC: Import/includes in .api files Hi All, I’d like to be able to re-use types defined in one .api file in many other .api files. My specific objective is to re-use a fib_path_t across the many APIs that describe a destination to which to send packets. My first attempt at this is: https://gerrit.fd.io/r/#/c/9489/ I updated vppapigen to accept the keyword ‘import’, munch the subsequent string, and then generate the #include in the resulting .api.h. then the fun started… multiple type definitions, include guards, here be dragons, turn back now and seek assistance. I later realised that an import statement is not required. If I create vnet/fib/fib.api and add it to vnet_all_api_h.h at the top, then that has some success. However, no import statement is not so friendly to other tools that parse the .api files. So an RFC that is really an RFH; how is it best to approach this? Regards, Neale _______________________________________________ vpp-dev mailing list vpp-dev@lists.fd.io https://lists.fd.io/mailman/listinfo/vpp-dev _______________________________________________ vpp-dev mailing list vpp-dev@lists.fd.io https://lists.fd.io/mailman/listinfo/vpp-dev