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

D3D10CreateBlob

関数
指定したバイト数の空のブロブバッファを作成する。
DLLd3d10.dll呼出規約winapi

シグネチャ

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

HRESULT D3D10CreateBlob(
    UINT_PTR NumBytes,
    ID3DBlob** ppBuffer
);

パラメーター

名前方向
NumBytesUINT_PTRin
ppBufferID3DBlob**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

D3D10CreateBlob = ctypes.windll.d3d10.D3D10CreateBlob
D3D10CreateBlob.restype = ctypes.c_int
D3D10CreateBlob.argtypes = [
    ctypes.c_size_t,  # NumBytes : UINT_PTR
    ctypes.c_void_p,  # ppBuffer : ID3DBlob** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	d3d10 = windows.NewLazySystemDLL("d3d10.dll")
	procD3D10CreateBlob = d3d10.NewProc("D3D10CreateBlob")
)

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