Win32 API 日本語リファレンス
ホームGraphics.DXCore › DXCoreCreateAdapterFactory

DXCoreCreateAdapterFactory

関数
DXCoreのアダプターファクトリを作成する。
DLLDXCORE.dll呼出規約winapi

シグネチャ

// DXCORE.dll
#include <windows.h>

HRESULT DXCoreCreateAdapterFactory(
    const GUID* riid,
    void** ppvFactory
);

パラメーター

名前方向説明
riidGUID*in要求するDXCoreアダプターファクトリーインターフェイスのIID。
ppvFactoryvoid**out生成されたアダプターファクトリーを受け取る出力先。

戻り値の型: HRESULT

各言語での呼び出し定義

// DXCORE.dll
#include <windows.h>

HRESULT DXCoreCreateAdapterFactory(
    const GUID* riid,
    void** ppvFactory
);
[DllImport("DXCORE.dll", ExactSpelling = true)]
static extern int DXCoreCreateAdapterFactory(
    ref Guid riid,   // GUID*
    IntPtr ppvFactory   // void** out
);
<DllImport("DXCORE.dll", ExactSpelling:=True)>
Public Shared Function DXCoreCreateAdapterFactory(
    ByRef riid As Guid,   ' GUID*
    ppvFactory As IntPtr   ' void** out
) As Integer
End Function
' riid : GUID*
' ppvFactory : void** out
Declare PtrSafe Function DXCoreCreateAdapterFactory Lib "dxcore" ( _
    ByVal riid As LongPtr, _
    ByVal ppvFactory As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DXCoreCreateAdapterFactory = ctypes.windll.dxcore.DXCoreCreateAdapterFactory
DXCoreCreateAdapterFactory.restype = ctypes.c_int
DXCoreCreateAdapterFactory.argtypes = [
    ctypes.c_void_p,  # riid : GUID*
    ctypes.c_void_p,  # ppvFactory : void** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DXCORE.dll')
DXCoreCreateAdapterFactory = Fiddle::Function.new(
  lib['DXCoreCreateAdapterFactory'],
  [
    Fiddle::TYPE_VOIDP,  # riid : GUID*
    Fiddle::TYPE_VOIDP,  # ppvFactory : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "dxcore")]
extern "system" {
    fn DXCoreCreateAdapterFactory(
        riid: *const GUID,  // GUID*
        ppvFactory: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DXCORE.dll")]
public static extern int DXCoreCreateAdapterFactory(ref Guid riid, IntPtr ppvFactory);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DXCORE_DXCoreCreateAdapterFactory' -Namespace Win32 -PassThru
# $api::DXCoreCreateAdapterFactory(riid, ppvFactory)
#uselib "DXCORE.dll"
#func global DXCoreCreateAdapterFactory "DXCoreCreateAdapterFactory" sptr, sptr
; DXCoreCreateAdapterFactory varptr(riid), ppvFactory   ; 戻り値は stat
; riid : GUID* -> "sptr"
; ppvFactory : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "DXCORE.dll"
#cfunc global DXCoreCreateAdapterFactory "DXCoreCreateAdapterFactory" var, sptr
; res = DXCoreCreateAdapterFactory(riid, ppvFactory)
; riid : GUID* -> "var"
; ppvFactory : void** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT DXCoreCreateAdapterFactory(GUID* riid, void** ppvFactory)
#uselib "DXCORE.dll"
#cfunc global DXCoreCreateAdapterFactory "DXCoreCreateAdapterFactory" var, intptr
; res = DXCoreCreateAdapterFactory(riid, ppvFactory)
; riid : GUID* -> "var"
; ppvFactory : void** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dxcore = windows.NewLazySystemDLL("DXCORE.dll")
	procDXCoreCreateAdapterFactory = dxcore.NewProc("DXCoreCreateAdapterFactory")
)

// riid (GUID*), ppvFactory (void** out)
r1, _, err := procDXCoreCreateAdapterFactory.Call(
	uintptr(riid),
	uintptr(ppvFactory),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DXCoreCreateAdapterFactory(
  riid: PGUID;   // GUID*
  ppvFactory: Pointer   // void** out
): Integer; stdcall;
  external 'DXCORE.dll' name 'DXCoreCreateAdapterFactory';
result := DllCall("DXCORE\DXCoreCreateAdapterFactory"
    , "Ptr", riid   ; GUID*
    , "Ptr", ppvFactory   ; void** out
    , "Int")   ; return: HRESULT
●DXCoreCreateAdapterFactory(riid, ppvFactory) = DLL("DXCORE.dll", "int DXCoreCreateAdapterFactory(void*, void*)")
# 呼び出し: DXCoreCreateAdapterFactory(riid, ppvFactory)
# riid : GUID* -> "void*"
# ppvFactory : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "dxcore" fn DXCoreCreateAdapterFactory(
    riid: [*c]GUID, // GUID*
    ppvFactory: ?*anyopaque // void** out
) callconv(std.os.windows.WINAPI) i32;
proc DXCoreCreateAdapterFactory(
    riid: ptr GUID,  # GUID*
    ppvFactory: pointer  # void** out
): int32 {.importc: "DXCoreCreateAdapterFactory", stdcall, dynlib: "DXCORE.dll".}
pragma(lib, "dxcore");
extern(Windows)
int DXCoreCreateAdapterFactory(
    GUID* riid,   // GUID*
    void** ppvFactory   // void** out
);
ccall((:DXCoreCreateAdapterFactory, "DXCORE.dll"), stdcall, Int32,
      (Ptr{GUID}, Ptr{Cvoid}),
      riid, ppvFactory)
# riid : GUID* -> Ptr{GUID}
# ppvFactory : void** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t DXCoreCreateAdapterFactory(
    void* riid,
    void** ppvFactory);
]]
local dxcore = ffi.load("dxcore")
-- dxcore.DXCoreCreateAdapterFactory(riid, ppvFactory)
-- riid : GUID*
-- ppvFactory : void** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('DXCORE.dll');
const DXCoreCreateAdapterFactory = lib.func('__stdcall', 'DXCoreCreateAdapterFactory', 'int32_t', ['void *', 'void *']);
// DXCoreCreateAdapterFactory(riid, ppvFactory)
// riid : GUID* -> 'void *'
// ppvFactory : void** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("DXCORE.dll", {
  DXCoreCreateAdapterFactory: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.DXCoreCreateAdapterFactory(riid, ppvFactory)
// riid : GUID* -> "pointer"
// ppvFactory : void** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t DXCoreCreateAdapterFactory(
    void* riid,
    void** ppvFactory);
C, "DXCORE.dll");
// $ffi->DXCoreCreateAdapterFactory(riid, ppvFactory);
// riid : GUID*
// ppvFactory : void** out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Dxcore extends StdCallLibrary {
    Dxcore INSTANCE = Native.load("dxcore", Dxcore.class);
    int DXCoreCreateAdapterFactory(
        Pointer riid,   // GUID*
        Pointer ppvFactory   // void** out
    );
}
@[Link("dxcore")]
lib LibDXCORE
  fun DXCoreCreateAdapterFactory = DXCoreCreateAdapterFactory(
    riid : GUID*,   # GUID*
    ppvFactory : Void**   # void** out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef DXCoreCreateAdapterFactoryNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef DXCoreCreateAdapterFactoryDart = int Function(Pointer<Void>, Pointer<Void>);
final DXCoreCreateAdapterFactory = DynamicLibrary.open('DXCORE.dll')
    .lookupFunction<DXCoreCreateAdapterFactoryNative, DXCoreCreateAdapterFactoryDart>('DXCoreCreateAdapterFactory');
// riid : GUID* -> Pointer<Void>
// ppvFactory : void** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function DXCoreCreateAdapterFactory(
  riid: PGUID;   // GUID*
  ppvFactory: Pointer   // void** out
): Integer; stdcall;
  external 'DXCORE.dll' name 'DXCoreCreateAdapterFactory';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "DXCoreCreateAdapterFactory"
  c_DXCoreCreateAdapterFactory :: Ptr () -> Ptr () -> IO Int32
-- riid : GUID* -> Ptr ()
-- ppvFactory : void** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let dxcorecreateadapterfactory =
  foreign "DXCoreCreateAdapterFactory"
    ((ptr void) @-> (ptr void) @-> returning int32_t)
(* riid : GUID* -> (ptr void) *)
(* ppvFactory : void** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library dxcore (t "DXCORE.dll"))
(cffi:use-foreign-library dxcore)

(cffi:defcfun ("DXCoreCreateAdapterFactory" dxcore-create-adapter-factory :convention :stdcall) :int32
  (riid :pointer)   ; GUID*
  (ppv-factory :pointer))   ; void** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DXCoreCreateAdapterFactory = Win32::API::More->new('DXCORE',
    'int DXCoreCreateAdapterFactory(LPVOID riid, LPVOID ppvFactory)');
# my $ret = $DXCoreCreateAdapterFactory->Call($riid, $ppvFactory);
# riid : GUID* -> LPVOID
# ppvFactory : void** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。