public void setCallingConvention(Convention.Style style) {
    if (style == null) return;

    if (!Platform.isWindows() || Platform.is64Bits()) return;

    switch (style) {
      case FastCall:
        this.direct = false;
        setDcCallingConvention(
            Platform.isWindows()
                ? DC_CALL_C_X86_WIN32_FAST_MS
                : DC_CALL_C_DEFAULT); // TODO allow GCC-compiled C++ libs on windows
        break;
      case Pascal:
      case StdCall:
        this.direct = false;
        setDcCallingConvention(DC_CALL_C_X86_WIN32_STD);
        break;
      case ThisCall:
        this.direct = false;
        setDcCallingConvention(
            Platform.isWindows() ? DC_CALL_C_X86_WIN32_THIS_MS : DC_CALL_C_DEFAULT);
    }
    if (BridJ.veryVerbose)
      BridJ.info("Setting CC " + style + " (-> " + dcCallingConvention + ") for " + methodName);
  }
  protected void init(
      AnnotatedElement annotatedElement,
      Class returnType,
      Type genericReturnType,
      Annotation[] returnAnnotations,
      Class[] parameterTypes,
      Type[] genericParameterTypes,
      Annotation[][] paramsAnnotations,
      boolean prependJNIPointers,
      boolean isVirtual,
      boolean isDirectModeAllowed) {
    assert returnType != null;
    assert genericReturnType != null;
    assert parameterTypes != null;
    assert genericParameterTypes != null;
    assert returnAnnotations != null;
    assert parameterTypes.length == genericParameterTypes.length;
    assert paramsAnnotations.length == genericParameterTypes.length;

    int nParams = genericParameterTypes.length;
    paramsValueTypes = new int[nParams];

    direct =
        isDirectModeAllowed; // TODO on native side : test number of parameters (on 64 bits win :
                             // must be <= 4)

    StringBuilder javaSig = new StringBuilder(64),
        asmSig = new StringBuilder(64),
        dcSig = new StringBuilder(16);
    javaSig.append('(');
    asmSig.append('(');
    if (prependJNIPointers) // !isCPlusPlus)
    dcSig
          .append(DC_SIGCHAR_POINTER)
          .append(DC_SIGCHAR_POINTER); // JNIEnv*, jobject: always present in native-bound functions

    if (BridJ.debug)
      BridJ.info(
          "Analyzing "
              + (declaringClass == null
                  ? "anonymous method"
                  : declaringClass.getName() + "." + methodName));

    if (isObjCBlock)
      appendToSignature(
          0, ValueType.ePointerValue, Pointer.class, Pointer.class, null, dcSig, null);

    for (int iParam = 0; iParam < nParams; iParam++) {
      //            Options paramOptions = paramsOptions[iParam] = new Options();
      Type genericParameterType = genericParameterTypes[iParam];
      Class<?> parameterType = parameterTypes[iParam];

      ValueType paramValueType =
          getValueType(
              iParam,
              nParams,
              parameterType,
              genericParameterType,
              null,
              paramsAnnotations[iParam]);
      if (BridJ.veryVerbose) BridJ.info("\tparam " + paramValueType);
      paramsValueTypes[iParam] = paramValueType.ordinal();

      appendToSignature(
          iParam, paramValueType, parameterType, genericParameterType, javaSig, dcSig, asmSig);
    }
    javaSig.append(')');
    asmSig.append(')');
    dcSig.append(')');

    ValueType retType =
        getValueType(
            -1, nParams, returnType, genericReturnType, annotatedElement, returnAnnotations);
    if (BridJ.veryVerbose) BridJ.info("\treturns " + retType);
    appendToSignature(-1, retType, returnType, genericReturnType, javaSig, dcSig, asmSig);
    returnValueType = retType.ordinal();

    javaSignature = javaSig.toString();
    asmSignature = asmSig.toString();
    dcSignature = dcSig.toString();

    isCPlusPlus = isCPlusPlus || isVirtual;

    if (isCPlusPlus && !isStatic) {
      if (!startsWithThis) direct = false;
      bNeedsThisPointer = true;
      if (Platform.isWindows()) {
        if (!Platform.is64Bits()) setDcCallingConvention(DC_CALL_C_X86_WIN32_THIS_MS);
      } else {
        // if (!Platform.is64Bits())
        //	setDcCallingConvention(DC_CALL_C_X86_WIN32_THIS_GNU);
      }
    }

    if (nParams > Platform.getMaxDirectMappingArgCount()) this.direct = false;

    if (BridJ.veryVerbose) {
      BridJ.info("\t-> direct " + direct);
      BridJ.info("\t-> javaSignature " + javaSignature);
      BridJ.info("\t-> callIOs " + callIOs);
      BridJ.info("\t-> asmSignature " + asmSignature);
      BridJ.info("\t-> dcSignature " + dcSignature);
    }

    if (BridJ.veryVerbose)
      BridJ.info((direct ? "[mappable as direct] " : "[not mappable as direct] ") + method);
  }