I have followed the necessary steps given in swig documentation, to generate a
wrapper for java using VS 2010.
23.2.8.1 Running SWIG from Visual Studio
If you are developing your application within Microsoft Visual studio, SWIG
can be invoked as a custom build option. The Examples\java directory has a few
Windows Examples containing Visual Studio project (.dsp) files. The process to
re-create the project files for a C project are roughly:
Open up a new workspace and use the AppWizard to select a DLL project.
Add both the SWIG interface file (the .i file), any supporting C files, and
the name of the wrapper file that will be created by SWIG (ie.
example_wrap.c). Don't worry if the wrapper file doesn't exist yet--Visual
Studio will keep a reference to it.
Select the SWIG interface file and go to the settings menu. Under settings,
select the "Custom Build" option.
Enter "SWIG" in the description field.
Enter "swig -java -o $(ProjDir)\$(InputName)_wrap.c $(InputPath) " in the
"Build command(s) field"
Enter "$(ProjDir)\$(InputName)_wrap.c" in the "Output files(s) field".
Next, select the settings for the entire project and go to C/C++ tab and
select the Preprocessor category . Add the include directories to the JNI
header files under "Additional include directories", eg
"C:\jdk1.3\include,C:\jdk1.3\include\win32".
Next, select the settings for the entire project and go to Link tab and select
the General category. Set the name of the output file to match the name of
your Java module (ie. example.dll).
Next, select the example.c and example_wrap.c files and go to the C/C++ tab
and select the Precompiled Headers tab in the project settings. Disabling
precompiled headers for these files will overcome any precompiled header
errors while building.
Finally, add the java compilation as a post build rule in the Post-build step
tab in project settings, eg, "c:\jdk1.3\bin\javac *.java"
Build your project.
But unfortunately, no luck. Maybe I am doing something wrong, as the following
settings are very different in VS 2010.
Can anyone please provide me some guideline on this.
P.S. I am loading pocketsphinx.sln and sphinxbase.sln in the new DLL project
for this step:
Add both the SWIG interface file (the .i file), any supporting C files,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have followed the necessary steps given in swig documentation, to generate a
wrapper for java using VS 2010.
23.2.8.1 Running SWIG from Visual Studio
If you are developing your application within Microsoft Visual studio, SWIG
can be invoked as a custom build option. The Examples\java directory has a few
Windows Examples containing Visual Studio project (.dsp) files. The process to
re-create the project files for a C project are roughly:
Open up a new workspace and use the AppWizard to select a DLL project.
Add both the SWIG interface file (the .i file), any supporting C files, and
the name of the wrapper file that will be created by SWIG (ie.
example_wrap.c). Don't worry if the wrapper file doesn't exist yet--Visual
Studio will keep a reference to it.
Select the SWIG interface file and go to the settings menu. Under settings,
select the "Custom Build" option.
Enter "SWIG" in the description field.
Enter "swig -java -o $(ProjDir)\$(InputName)_wrap.c $(InputPath) " in the
"Build command(s) field"
Enter "$(ProjDir)\$(InputName)_wrap.c" in the "Output files(s) field".
Next, select the settings for the entire project and go to C/C++ tab and
select the Preprocessor category . Add the include directories to the JNI
header files under "Additional include directories", eg
"C:\jdk1.3\include,C:\jdk1.3\include\win32".
Next, select the settings for the entire project and go to Link tab and select
the General category. Set the name of the output file to match the name of
your Java module (ie. example.dll).
Next, select the example.c and example_wrap.c files and go to the C/C++ tab
and select the Precompiled Headers tab in the project settings. Disabling
precompiled headers for these files will overcome any precompiled header
errors while building.
Finally, add the java compilation as a post build rule in the Post-build step
tab in project settings, eg, "c:\jdk1.3\bin\javac *.java"
Build your project.
But unfortunately, no luck. Maybe I am doing something wrong, as the following
settings are very different in VS 2010.
Can anyone please provide me some guideline on this.
P.S. I am loading pocketsphinx.sln and sphinxbase.sln in the new DLL project
for this step: