[D] Added workaround for LDC to the D1 version of the 'funcptr' example.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12361 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0c3f855cc9
commit
a344899ed8
1 changed files with 12 additions and 4 deletions
|
|
@ -27,8 +27,16 @@ void main() {
|
|||
Stdout( " SUB(a,b) = " )( example.do_op( a, b, example.SUB ) ).newline;
|
||||
Stdout( " MUL(a,b) = " )( example.do_op( a, b, example.MUL ) ).newline;
|
||||
|
||||
Stdout( "Now the same with callback functions defined in D:" ).newline;
|
||||
Stdout( " add(a,b) = " )( example.do_op( a, b, &add ) ).newline;
|
||||
Stdout( " sub(a,b) = " )( example.do_op( a, b, &sub ) ).newline;
|
||||
Stdout( " mul(a,b) = " )( example.do_op( a, b, &mul ) ).newline;
|
||||
version (LDC) {
|
||||
// Currently, there is no way to specify the calling convention for
|
||||
// function pointer parameters in D, but LDC does strict typechecking for
|
||||
// them (which is reasonable, but not covered by the language spec yet).
|
||||
// As a result, there is no way to make the code below compile with LDC at
|
||||
// the moment, so just skip it.
|
||||
} else {
|
||||
Stdout( "Now the same with callback functions defined in D:" ).newline;
|
||||
Stdout( " add(a,b) = " )( example.do_op( a, b, &add ) ).newline;
|
||||
Stdout( " sub(a,b) = " )( example.do_op( a, b, &sub ) ).newline;
|
||||
Stdout( " mul(a,b) = " )( example.do_op( a, b, &mul ) ).newline;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue