ホーム › Graphics.Direct3D.Dxc › DxcCreateInstance2
DxcCreateInstance2
関数指定アロケータでDXCインスタンスを生成する。
シグネチャ
// dxcompiler.dll
#include <windows.h>
HRESULT DxcCreateInstance2(
IMalloc* pMalloc,
const GUID* rclsid,
const GUID* riid,
void** ppv
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pMalloc | IMalloc* | in |
| rclsid | GUID* | in |
| riid | GUID* | in |
| ppv | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// dxcompiler.dll
#include <windows.h>
HRESULT DxcCreateInstance2(
IMalloc* pMalloc,
const GUID* rclsid,
const GUID* riid,
void** ppv
);[DllImport("dxcompiler.dll", ExactSpelling = true)]
static extern int DxcCreateInstance2(
IntPtr pMalloc, // IMalloc*
ref Guid rclsid, // GUID*
ref Guid riid, // GUID*
IntPtr ppv // void** out
);<DllImport("dxcompiler.dll", ExactSpelling:=True)>
Public Shared Function DxcCreateInstance2(
pMalloc As IntPtr, ' IMalloc*
ByRef rclsid As Guid, ' GUID*
ByRef riid As Guid, ' GUID*
ppv As IntPtr ' void** out
) As Integer
End Function' pMalloc : IMalloc*
' rclsid : GUID*
' riid : GUID*
' ppv : void** out
Declare PtrSafe Function DxcCreateInstance2 Lib "dxcompiler" ( _
ByVal pMalloc As LongPtr, _
ByVal rclsid As LongPtr, _
ByVal riid As LongPtr, _
ByVal ppv As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DxcCreateInstance2 = ctypes.windll.dxcompiler.DxcCreateInstance2
DxcCreateInstance2.restype = ctypes.c_int
DxcCreateInstance2.argtypes = [
ctypes.c_void_p, # pMalloc : IMalloc*
ctypes.c_void_p, # rclsid : GUID*
ctypes.c_void_p, # riid : GUID*
ctypes.c_void_p, # ppv : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dxcompiler.dll')
DxcCreateInstance2 = Fiddle::Function.new(
lib['DxcCreateInstance2'],
[
Fiddle::TYPE_VOIDP, # pMalloc : IMalloc*
Fiddle::TYPE_VOIDP, # rclsid : GUID*
Fiddle::TYPE_VOIDP, # riid : GUID*
Fiddle::TYPE_VOIDP, # ppv : void** out
],
Fiddle::TYPE_INT)#[link(name = "dxcompiler")]
extern "system" {
fn DxcCreateInstance2(
pMalloc: *mut core::ffi::c_void, // IMalloc*
rclsid: *const GUID, // GUID*
riid: *const GUID, // GUID*
ppv: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("dxcompiler.dll")]
public static extern int DxcCreateInstance2(IntPtr pMalloc, ref Guid rclsid, ref Guid riid, IntPtr ppv);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dxcompiler_DxcCreateInstance2' -Namespace Win32 -PassThru
# $api::DxcCreateInstance2(pMalloc, rclsid, riid, ppv)#uselib "dxcompiler.dll"
#func global DxcCreateInstance2 "DxcCreateInstance2" sptr, sptr, sptr, sptr
; DxcCreateInstance2 pMalloc, varptr(rclsid), varptr(riid), ppv ; 戻り値は stat
; pMalloc : IMalloc* -> "sptr"
; rclsid : GUID* -> "sptr"
; riid : GUID* -> "sptr"
; ppv : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dxcompiler.dll" #cfunc global DxcCreateInstance2 "DxcCreateInstance2" sptr, var, var, sptr ; res = DxcCreateInstance2(pMalloc, rclsid, riid, ppv) ; pMalloc : IMalloc* -> "sptr" ; rclsid : GUID* -> "var" ; riid : GUID* -> "var" ; ppv : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dxcompiler.dll" #cfunc global DxcCreateInstance2 "DxcCreateInstance2" sptr, sptr, sptr, sptr ; res = DxcCreateInstance2(pMalloc, varptr(rclsid), varptr(riid), ppv) ; pMalloc : IMalloc* -> "sptr" ; rclsid : GUID* -> "sptr" ; riid : GUID* -> "sptr" ; ppv : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DxcCreateInstance2(IMalloc* pMalloc, GUID* rclsid, GUID* riid, void** ppv) #uselib "dxcompiler.dll" #cfunc global DxcCreateInstance2 "DxcCreateInstance2" intptr, var, var, intptr ; res = DxcCreateInstance2(pMalloc, rclsid, riid, ppv) ; pMalloc : IMalloc* -> "intptr" ; rclsid : GUID* -> "var" ; riid : GUID* -> "var" ; ppv : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DxcCreateInstance2(IMalloc* pMalloc, GUID* rclsid, GUID* riid, void** ppv) #uselib "dxcompiler.dll" #cfunc global DxcCreateInstance2 "DxcCreateInstance2" intptr, intptr, intptr, intptr ; res = DxcCreateInstance2(pMalloc, varptr(rclsid), varptr(riid), ppv) ; pMalloc : IMalloc* -> "intptr" ; rclsid : GUID* -> "intptr" ; riid : GUID* -> "intptr" ; ppv : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dxcompiler = windows.NewLazySystemDLL("dxcompiler.dll")
procDxcCreateInstance2 = dxcompiler.NewProc("DxcCreateInstance2")
)
// pMalloc (IMalloc*), rclsid (GUID*), riid (GUID*), ppv (void** out)
r1, _, err := procDxcCreateInstance2.Call(
uintptr(pMalloc),
uintptr(rclsid),
uintptr(riid),
uintptr(ppv),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DxcCreateInstance2(
pMalloc: Pointer; // IMalloc*
rclsid: PGUID; // GUID*
riid: PGUID; // GUID*
ppv: Pointer // void** out
): Integer; stdcall;
external 'dxcompiler.dll' name 'DxcCreateInstance2';result := DllCall("dxcompiler\DxcCreateInstance2"
, "Ptr", pMalloc ; IMalloc*
, "Ptr", rclsid ; GUID*
, "Ptr", riid ; GUID*
, "Ptr", ppv ; void** out
, "Int") ; return: HRESULT●DxcCreateInstance2(pMalloc, rclsid, riid, ppv) = DLL("dxcompiler.dll", "int DxcCreateInstance2(void*, void*, void*, void*)")
# 呼び出し: DxcCreateInstance2(pMalloc, rclsid, riid, ppv)
# pMalloc : IMalloc* -> "void*"
# rclsid : GUID* -> "void*"
# riid : GUID* -> "void*"
# ppv : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。