# Gr-modtool and SWIG file line order

**URL:** <https://www.ruby-forum.com/t/gr-modtool-and-swig-file-line-order/226935>\
**Category:** GNU Radio\
**Created:** [February 26, 2013, 11:11am UTC](https://www.ruby-forum.com/t/gr-modtool-and-swig-file-line-order/226935 "2013-02-26T11:11:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_BSSCEL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/73ab20/32.png) [@Martin\_BSSCEL](https://www.ruby-forum.com/u/Martin_BSSCEL)\
**Post date:** [February 26, 2013, 11:11am UTC](https://www.ruby-forum.com/t/gr-modtool-and-swig-file-line-order/226935/1 "2013-02-26T11:11:04Z")

</div>

This seems to have been confusing everyone,

so here’s the answer:

== \>= 3.7 ==  
In the 3.7-style module structure (which uses the include/MODULENAME/  
directory and omits the module prefix from the file names), the correct  
order is:

%include “…”  
GR\_SWIG\_BLOCK\_MAGIC2(…)

This format is automatically chosen for new modules. We generally  
recommend this format.

== Older Format ==  
In the pre-3.7 format (without the impl-files, and with the \*.h in  
include/), the correct order is:

GR\_SWIG\_BLOCK\_MAGIC(…)  
%include “…”

A major difference between the way modtool handles swigging in this  
style  
modules is that no \*.i files are generated, but rather the \*.h files are  
included. If this doesn’t work, you’ll have to generate the \*.i file by  
hand.

If you’re using a current version of modtool, this _should all work  
automatically_.

MB

–  
Karlsruhe Institute of Technology (KIT)  
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin B.  
Research Associate

Kaiserstraße 12  
Building 05.01  
76131 Karlsruhe

Phone: +49 721 608-43790  
Fax: +49 721 608-46071  
www.cel.kit.edu

KIT – University of the State of Baden-Württemberg and  
National Laboratory of the Helmholtz Association
