MCPcopy Create free account
hub / github.com/java-native-access/jna / W32APIFunctionMapper

Class W32APIFunctionMapper

src/com/sun/jna/win32/W32APIFunctionMapper.java:34–56  ·  view source on GitHub ↗

Encapsulates lookup of W32 API UNICODE/ASCII functions.

Source from the content-addressed store, hash-verified

32 * Encapsulates lookup of W32 API UNICODE/ASCII functions.
33 */
34public class W32APIFunctionMapper implements FunctionMapper {
35 public static final FunctionMapper UNICODE = new W32APIFunctionMapper(true);
36 public static final FunctionMapper ASCII = new W32APIFunctionMapper(false);
37 private final String suffix;
38 protected W32APIFunctionMapper(boolean unicode) {
39 this.suffix = unicode ? "W" : "A";
40 }
41 /**
42 * Looks up the method name by adding a "W" or "A" suffix as appropriate.
43 */
44 public String getFunctionName(NativeLibrary library, Method method) {
45 String name = method.getName();
46 if (!name.endsWith("W") && !name.endsWith("A")) {
47 try {
48 name = library.getFunction(name + suffix, StdCallLibrary.STDCALL_CONVENTION).getName();
49 }
50 catch(UnsatisfiedLinkError e) {
51 // ignore and let caller use undecorated name
52 }
53 }
54 return name;
55 }
56}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…