MCPcopy Create free account
hub / github.com/capstone-engine/capstone / Capstone

Method Capstone

bindings/java/capstone/Capstone.java:440–459  ·  view source on GitHub ↗
(int arch, int mode)

Source from the content-addressed store, hash-verified

438 private boolean diet;
439
440 public Capstone(int arch, int mode) {
441 cs = (CS)Native.loadLibrary("capstone", CS.class);
442 int coreVersion = cs.cs_version(null, null);
443 int bindingVersion = (CS_API_MAJOR << 8) + CS_API_MINOR;
444 if (coreVersion != bindingVersion) {
445 throw new RuntimeException("Different API version between core " + coreVersion +
446 " & binding " + bindingVersion + " (CS_ERR_VERSION)");
447 }
448
449 this.arch = arch;
450 this.mode = mode;
451 ns = new NativeStruct();
452 ns.handleRef = new PointerByReference();
453 if (cs.cs_open(arch, mode, ns.handleRef) != CS_ERR_OK) {
454 throw new RuntimeException("ERROR: Wrong arch or mode");
455 }
456 ns.csh = ns.handleRef.getValue();
457 this.detail = CS_OPT_OFF;
458 this.diet = cs.cs_support(CS_SUPPORT_DIET);
459 }
460
461 // return combined API version
462 public int version() {

Callers

nothing calls this directly

Calls 4

cs_versionMethod · 0.80
cs_openMethod · 0.80
cs_supportMethod · 0.80
getValueMethod · 0.45

Tested by

no test coverage detected