Win32 API 日本語リファレンス
ホームGraphics.Direct3D.Fxc › D3DCreateBlob

D3DCreateBlob

関数
指定したサイズの空のブロブバッファ(ID3DBlob)を作成する。
DLLD3DCOMPILER_47.dll呼出規約winapi

シグネチャ

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

HRESULT D3DCreateBlob(
    UINT_PTR Size,
    ID3DBlob** ppBlob
);

パラメーター

名前方向説明
SizeUINT_PTRin新規に確保するBlobのバイトサイズ。
ppBlobID3DBlob**out生成された空のID3DBlobを受け取る出力ポインター。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT D3DCreateBlob(
    UINT_PTR Size,
    ID3DBlob** ppBlob
);
[DllImport("D3DCOMPILER_47.dll", ExactSpelling = true)]
static extern int D3DCreateBlob(
    UIntPtr Size,   // UINT_PTR
    IntPtr ppBlob   // ID3DBlob** out
);
<DllImport("D3DCOMPILER_47.dll", ExactSpelling:=True)>
Public Shared Function D3DCreateBlob(
    Size As UIntPtr,   ' UINT_PTR
    ppBlob As IntPtr   ' ID3DBlob** out
) As Integer
End Function
' Size : UINT_PTR
' ppBlob : ID3DBlob** out
Declare PtrSafe Function D3DCreateBlob Lib "d3dcompiler_47" ( _
    ByVal Size As LongPtr, _
    ByVal ppBlob As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

D3DCreateBlob = ctypes.windll.d3dcompiler_47.D3DCreateBlob
D3DCreateBlob.restype = ctypes.c_int
D3DCreateBlob.argtypes = [
    ctypes.c_size_t,  # Size : UINT_PTR
    ctypes.c_void_p,  # ppBlob : ID3DBlob** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('D3DCOMPILER_47.dll')
D3DCreateBlob = Fiddle::Function.new(
  lib['D3DCreateBlob'],
  [
    Fiddle::TYPE_UINTPTR_T,  # Size : UINT_PTR
    Fiddle::TYPE_VOIDP,  # ppBlob : ID3DBlob** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "d3dcompiler_47")]
extern "system" {
    fn D3DCreateBlob(
        Size: usize,  // UINT_PTR
        ppBlob: *mut *mut core::ffi::c_void  // ID3DBlob** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("D3DCOMPILER_47.dll")]
public static extern int D3DCreateBlob(UIntPtr Size, IntPtr ppBlob);
"@
$api = Add-Type -MemberDefinition $sig -Name 'D3DCOMPILER_47_D3DCreateBlob' -Namespace Win32 -PassThru
# $api::D3DCreateBlob(Size, ppBlob)
#uselib "D3DCOMPILER_47.dll"
#func global D3DCreateBlob "D3DCreateBlob" sptr, sptr
; D3DCreateBlob Size, ppBlob   ; 戻り値は stat
; Size : UINT_PTR -> "sptr"
; ppBlob : ID3DBlob** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "D3DCOMPILER_47.dll"
#cfunc global D3DCreateBlob "D3DCreateBlob" sptr, sptr
; res = D3DCreateBlob(Size, ppBlob)
; Size : UINT_PTR -> "sptr"
; ppBlob : ID3DBlob** out -> "sptr"
; HRESULT D3DCreateBlob(UINT_PTR Size, ID3DBlob** ppBlob)
#uselib "D3DCOMPILER_47.dll"
#cfunc global D3DCreateBlob "D3DCreateBlob" intptr, intptr
; res = D3DCreateBlob(Size, ppBlob)
; Size : UINT_PTR -> "intptr"
; ppBlob : ID3DBlob** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	d3dcompiler_47 = windows.NewLazySystemDLL("D3DCOMPILER_47.dll")
	procD3DCreateBlob = d3dcompiler_47.NewProc("D3DCreateBlob")
)

// Size (UINT_PTR), ppBlob (ID3DBlob** out)
r1, _, err := procD3DCreateBlob.Call(
	uintptr(Size),
	uintptr(ppBlob),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function D3DCreateBlob(
  Size: NativeUInt;   // UINT_PTR
  ppBlob: Pointer   // ID3DBlob** out
): Integer; stdcall;
  external 'D3DCOMPILER_47.dll' name 'D3DCreateBlob';
result := DllCall("D3DCOMPILER_47\D3DCreateBlob"
    , "UPtr", Size   ; UINT_PTR
    , "Ptr", ppBlob   ; ID3DBlob** out
    , "Int")   ; return: HRESULT
●D3DCreateBlob(Size, ppBlob) = DLL("D3DCOMPILER_47.dll", "int D3DCreateBlob(int, void*)")
# 呼び出し: D3DCreateBlob(Size, ppBlob)
# Size : UINT_PTR -> "int"
# ppBlob : ID3DBlob** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。