Skip to content

Commit 6e99ab0

Browse files
committed
Merge pull request #3 from notnoop/master
Correct the Callback documentation
2 parents ed900e2 + 4b8d910 commit 6e99ab0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Diff for: www/CallbacksAndClosures.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ Callbacks and Closures
22
======================
33

44
Callback declarations consist of a simple interface that extends the Callback interface and implements a callback method (or defines a single method of arbitrary name). Callbacks are implemented by wrapping a Java object method in a little bit of C glue code. The simplest usage resembles using anonymous inner classes to register event listeners. Following is an example of callback usage:
5-
5+
66
// Original C declarations
7-
typedef void (*sig_t)(int);
8-
sig_t signal(sig_t);
7+
typedef void (*sig_t) (int);
8+
sig_t signal(int sig, sig_t func);
9+
int SIGUSR1 = 30;
910

1011
// Equivalent JNA mappings
1112
public interface CLibrary extends Library {
1213
int SIGUSR1 = 30;
1314
interface sig_t extends Callback {
14-
void invoke(int signal);
15+
void invoke(int signal);
1516
}
1617
sig_t signal(int sig, sig_t fn);
1718
int raise(int sig);
@@ -32,7 +33,7 @@ Callback declarations consist of a simple interface that extends the Callback in
3233
...
3334

3435
Here is a more involved example, using the Win32 APIs to enumerate all native windows:
35-
36+
3637
// Original C declarations
3738
typedef int (__stdcall *WNDENUMPROC)(void*,void*);
3839
int __stdcall EnumWindows(WNDENUMPROC,void*);

0 commit comments

Comments
 (0)