com.sun.jna.Function.getFunction()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(377)

本文整理了Java中com.sun.jna.Function.getFunction()方法的一些代码示例,展示了Function.getFunction()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Function.getFunction()方法的具体详情如下:
包路径:com.sun.jna.Function
类名称:Function
方法名:getFunction

Function.getFunction介绍

[英]Obtain a Function representing a native function pointer. In general, this function should be used by dynamic languages; Java code should allow JNA to bind to a specific Callback interface instead by defining a return type or Structure field type.

The allocated instance represents a pointer to the native function pointer.
[中]获取表示本机函数指针的Function。一般来说,动态语言应该使用这个函数;Java代码应该允许JNA通过定义返回类型或结构字段类型绑定到特定的回调接口。
分配的实例表示指向本机函数指针的指针。

代码示例

代码示例来源:origin: net.java.dev.jna/jna

  1. /**
  2. * Obtain a <code>Function</code> representing a native
  3. * function pointer. In general, this function should be used by dynamic
  4. * languages; Java code should allow JNA to bind to a specific Callback
  5. * interface instead by defining a return type or Structure field type.
  6. *
  7. * <p>The allocated instance represents a pointer to the native
  8. * function pointer.
  9. *
  10. * @param p Native function pointer
  11. */
  12. public static Function getFunction(Pointer p) {
  13. return getFunction(p, 0, null);
  14. }

代码示例来源:origin: net.java.dev.jna/jna

  1. /**
  2. * Obtain a <code>Function</code> representing a native
  3. * function pointer. In general, this function should be used by dynamic
  4. * languages; Java code should allow JNA to bind to a specific Callback
  5. * interface instead by defining a return type or Structure field type.
  6. *
  7. * <p>The allocated instance represents a pointer to the native
  8. * function pointer.
  9. *
  10. * @param p
  11. * Native function pointer
  12. * @param callFlags
  13. * Function <a href="#callflags">call flags</a>
  14. */
  15. public static Function getFunction(Pointer p, int callFlags) {
  16. return getFunction(p, callFlags, null);
  17. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public int AddRef() {
  3. Function f = Function.getFunction(vTable[1], Function.ALT_CONVENTION);
  4. return f.invokeInt(new Object[]{interfacePointer});
  5. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public WinNT.HRESULT QueryInterface(REFIID byValue, PointerByReference pointerByReference) {
  3. Function f = Function.getFunction(vTable[0], Function.ALT_CONVENTION);
  4. return new WinNT.HRESULT(f.invokeInt(new Object[]{interfacePointer, byValue, pointerByReference}));
  5. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public WinNT.HRESULT QueryInterface(REFIID byValue, PointerByReference pointerByReference) {
  3. Function f = Function.getFunction(vTable[0], Function.ALT_CONVENTION);
  4. return new WinNT.HRESULT(f.invokeInt(new Object[]{interfacePointer, byValue, pointerByReference}));
  5. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public HRESULT GetUIObjectOf(WinDef.HWND hwndOwner, int cidl, Pointer apidl, REFIID riid, IntByReference rgfReserved, PointerByReference ppv) {
  3. Function f = Function.getFunction(vTable[10], Function.ALT_CONVENTION);
  4. return new WinNT.HRESULT( f.invokeInt(new Object[]{interfacePointer, hwndOwner, cidl, apidl, riid, rgfReserved, ppv}));
  5. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public HRESULT Clone(PointerByReference ppenum) {
  3. Function f = Function.getFunction(vTable[6], Function.ALT_CONVENTION);
  4. return new HRESULT(f.invokeInt(new Object[]{interfacePointer, ppenum}));
  5. }
  6. };

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public WinNT.HRESULT ParseDisplayName(WinDef.HWND hwnd, Pointer pbc, String pszDisplayName, IntByReference pchEaten, PointerByReference ppidl, IntByReference pdwAttributes) {
  3. Function f = Function.getFunction(vTable[3], Function.ALT_CONVENTION);
  4. return new WinNT.HRESULT(f.invokeInt(new Object[]{interfacePointer, hwnd, pbc, pszDisplayName, pchEaten, ppidl, pdwAttributes}));
  5. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public HRESULT BindToStorage(Pointer pidl, Pointer pbc, REFIID riid, PointerByReference ppv) {
  3. Function f = Function.getFunction(vTable[6], Function.ALT_CONVENTION);
  4. return new WinNT.HRESULT( f.invokeInt(new Object[]{interfacePointer, pidl, pbc, riid, ppv}));
  5. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public HRESULT CompareIDs(WinDef.LPARAM lParam, Pointer pidl1, Pointer pidl2) {
  3. Function f = Function.getFunction(vTable[7], Function.ALT_CONVENTION);
  4. return new WinNT.HRESULT( f.invokeInt(new Object[]{interfacePointer, lParam, pidl1, pidl2}));
  5. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public HRESULT CreateViewObject(WinDef.HWND hwndOwner, REFIID riid, PointerByReference ppv) {
  3. Function f = Function.getFunction(vTable[8], Function.ALT_CONVENTION);
  4. return new WinNT.HRESULT( f.invokeInt(new Object[]{interfacePointer, hwndOwner, riid, ppv}));
  5. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public HRESULT GetAttributesOf(int cidl, Pointer apidl, IntByReference rgfInOut) {
  3. Function f = Function.getFunction(vTable[9], Function.ALT_CONVENTION);
  4. return new WinNT.HRESULT( f.invokeInt(new Object[]{interfacePointer, cidl, apidl, rgfInOut}));
  5. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. @Override
  2. public HRESULT SetNameOf(WinDef.HWND hwnd, Pointer pidl, String pszName, int uFlags, PointerByReference ppidlOut) {
  3. Function f = Function.getFunction(vTable[12], Function.ALT_CONVENTION);
  4. return new WinNT.HRESULT( f.invokeInt(new Object[]{interfacePointer, hwnd, pidl, pszName, uFlags, ppidlOut}));
  5. }
  6. };

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. protected int _invokeNativeInt(int vtableId, Object[] args) {
  2. Pointer vptr = this.getPointer().getPointer(0);
  3. // we take the vtable id and multiply with the pointer size (4 bytes on
  4. // 32bit OS)
  5. Function func = Function.getFunction(vptr.getPointer(vtableId
  6. * Native.POINTER_SIZE));
  7. return func.invokeInt(args);
  8. }

代码示例来源:origin: net.java.dev.jna/jna-platform

  1. protected void _invokeNativeVoid(int vtableId, Object[] args) {
  2. Pointer vptr = this.getPointer().getPointer(0);
  3. // we take the vtable id and multiply with the pointer size (4 bytes on
  4. // 32bit OS)
  5. Function func = Function.getFunction(vptr.getPointer(vtableId
  6. * Native.POINTER_SIZE));
  7. func.invokeVoid(args);
  8. }

代码示例来源:origin: net.java.dev.jna/platform

  1. public/* [local] */void ReleaseVarDesc(
  2. /* [in] */VARDESC pVarDesc) {
  3. Pointer vptr = this.getPointer().getPointer(0);
  4. Function func = Function.getFunction(vptr.getPointer(84));
  5. func.invokeInt(new Object[] { this.getPointer(), pVarDesc });
  6. }
  7. }

代码示例来源:origin: net.java.dev.jna/platform

  1. public HRESULT IsName(
  2. /* [annotation][out][in] */
  3. WString szNameBuf,
  4. /* [in] */ULONG lHashVal,
  5. /* [out] */BOOLbyReference pfName) {
  6. Pointer vptr = this.getPointer().getPointer(0);
  7. Function func = Function.getFunction(vptr.getPointer(40));
  8. int hr = func.invokeInt(new Object[] { this.getPointer(), szNameBuf,
  9. lHashVal, pfName });
  10. return new HRESULT(hr);
  11. }

代码示例来源:origin: net.java.dev.jna/platform

  1. public/* [local] */HRESULT GetFuncDesc(
  2. /* [in] */UINT index,
  3. /* [out] */FUNCDESC.ByReference pFuncDesc) {
  4. Pointer vptr = this.getPointer().getPointer(0);
  5. Function func = Function.getFunction(vptr.getPointer(20));
  6. int hr = func.invokeInt(new Object[] { this.getPointer(), index,
  7. pFuncDesc });
  8. return new HRESULT(hr);
  9. }

代码示例来源:origin: net.java.dev.jna/platform

  1. public/* [local] */HRESULT GetNames(
  2. /* [in] */MEMBERID memid,
  3. /* [length_is][size_is][out] */BSTR[] rgBstrNames,
  4. /* [in] */UINT cMaxNames,
  5. /* [out] */UINTbyReference pcNames) {
  6. Pointer vptr = this.getPointer().getPointer(0);
  7. Function func = Function.getFunction(vptr.getPointer(28));
  8. int hr = func.invokeInt(new Object[] { this.getPointer(), memid,
  9. rgBstrNames, cMaxNames, pcNames });
  10. return new HRESULT(hr);
  11. }

代码示例来源:origin: net.java.dev.jna/platform

  1. public HRESULT GetTypeAttr(
  2. /* [out] */TYPEATTR.ByReference pTypeAttr) {
  3. Pointer vptr = this.getPointer().getPointer(0);
  4. Function func = Function.getFunction(vptr.getPointer(12));
  5. int hr = func.invokeInt(new Object[] { this.getPointer(), pTypeAttr });
  6. pTypeAttr.read();
  7. return new HRESULT(hr);
  8. }

相关文章