Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a package declaration to java generated by SWIG

I'm using SWIG to generate a bunch of Java files -- I want the files to be part of a certain package ... right now after I generate them I have to go in and manually add the import declaration ... is there a way to template this into swig?

like image 456
user491880 Avatar asked Aug 16 '12 21:08

user491880


People also ask

How do I import a package in Java?

To import a whole package, end the sentence with an asterisk sign ( * ). The following example will import ALL the classes in the java.util package: To create your own package, you need to understand that Java uses a file system directory to store them. Just like folders on your computer: To create a package, use the package keyword:

How does Swig wrap simple C declarations?

SWIG wraps simple C declarations by creating an interface that closely matches the way in which the declarations would be used in a C program. For example, consider the following interface file:

How to create inbuilt packages in Java?

These are called as Inbuilt Packages . Now in order to create a package in java follow the certain steps as described below: First We Should Choose A Name For The Package We Are Going To Create And Include. The package command In The first line in the java program source code.

Why does Swig not release the previous contents of a variable?

When variables of type const char * are declared, SWIG still generates functions for setting and getting the value. However, the default behavior does not release the previous contents (resulting in a possible memory leak). In fact, you may get a warning message such as this when wrapping such a variable: example.i:20. Typemap warning.


1 Answers

Just need to specify the package as follows

mkdir -p com/example/package
swig -java -package com.example.package -outdir com/example/package example.i
like image 179
user491880 Avatar answered Nov 14 '22 21:11

user491880