Fix seg fault using %template
Fix seg fault when instantiating templates with parameters that are function
parameters containing templates, such as:
%template(MyC) C<int(std::vector<int>)>;
Closes #983
This commit is contained in:
parent
2fc0edc4fd
commit
b18b75369c
4 changed files with 60 additions and 1 deletions
25
Examples/test-suite/java/template_function_parm_runme.java
Normal file
25
Examples/test-suite/java/template_function_parm_runme.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import template_function_parm.*;
|
||||
|
||||
public class template_function_parm_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_function_parm");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
VectorInt vi = new VectorInt();
|
||||
vi.add(10);
|
||||
vi.add(20);
|
||||
vi.add(30);
|
||||
|
||||
MyC myc = new MyC();
|
||||
int sum = myc.take_function(template_function_parmConstants.accumulate_integers, vi);
|
||||
if (sum != 60)
|
||||
throw new RuntimeException("Expected sum of 60, got " + sum);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue