ホーム › Graphics.Direct3D10 › D3D10CreateBlob
D3D10CreateBlob
関数指定したバイト数の空のブロブバッファを作成する。
シグネチャ
// d3d10.dll
#include <windows.h>
HRESULT D3D10CreateBlob(
UINT_PTR NumBytes,
ID3DBlob** ppBuffer
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| NumBytes | UINT_PTR | in | 確保するブロブのバイトサイズを指定する。 |
| ppBuffer | ID3DBlob** | out | 確保された空のID3DBlobを受け取る出力ポインター。 |
戻り値の型: 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 // HRESULTfunction 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)。const std = @import("std");
extern "d3d10" fn D3D10CreateBlob(
NumBytes: usize, // UINT_PTR
ppBuffer: ?*anyopaque // ID3DBlob** out
) callconv(std.os.windows.WINAPI) i32;proc D3D10CreateBlob(
NumBytes: uint, # UINT_PTR
ppBuffer: pointer # ID3DBlob** out
): int32 {.importc: "D3D10CreateBlob", stdcall, dynlib: "d3d10.dll".}pragma(lib, "d3d10");
extern(Windows)
int D3D10CreateBlob(
size_t NumBytes, // UINT_PTR
void* ppBuffer // ID3DBlob** out
);ccall((:D3D10CreateBlob, "d3d10.dll"), stdcall, Int32,
(Csize_t, Ptr{Cvoid}),
NumBytes, ppBuffer)
# NumBytes : UINT_PTR -> Csize_t
# ppBuffer : ID3DBlob** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t D3D10CreateBlob(
uintptr_t NumBytes,
void* ppBuffer);
]]
local d3d10 = ffi.load("d3d10")
-- d3d10.D3D10CreateBlob(NumBytes, ppBuffer)
-- NumBytes : UINT_PTR
-- ppBuffer : ID3DBlob** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('d3d10.dll');
const D3D10CreateBlob = lib.func('__stdcall', 'D3D10CreateBlob', 'int32_t', ['uintptr_t', 'void *']);
// D3D10CreateBlob(NumBytes, ppBuffer)
// NumBytes : UINT_PTR -> 'uintptr_t'
// ppBuffer : ID3DBlob** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("d3d10.dll", {
D3D10CreateBlob: { parameters: ["usize", "pointer"], result: "i32" },
});
// lib.symbols.D3D10CreateBlob(NumBytes, ppBuffer)
// NumBytes : UINT_PTR -> "usize"
// ppBuffer : ID3DBlob** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t D3D10CreateBlob(
size_t NumBytes,
void* ppBuffer);
C, "d3d10.dll");
// $ffi->D3D10CreateBlob(NumBytes, ppBuffer);
// NumBytes : UINT_PTR
// ppBuffer : ID3DBlob** 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 D3d10 extends StdCallLibrary {
D3d10 INSTANCE = Native.load("d3d10", D3d10.class);
int D3D10CreateBlob(
long NumBytes, // UINT_PTR
Pointer ppBuffer // ID3DBlob** out
);
}@[Link("d3d10")]
lib Libd3d10
fun D3D10CreateBlob = D3D10CreateBlob(
NumBytes : LibC::SizeT, # UINT_PTR
ppBuffer : Void* # ID3DBlob** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef D3D10CreateBlobNative = Int32 Function(UintPtr, Pointer<Void>);
typedef D3D10CreateBlobDart = int Function(int, Pointer<Void>);
final D3D10CreateBlob = DynamicLibrary.open('d3d10.dll')
.lookupFunction<D3D10CreateBlobNative, D3D10CreateBlobDart>('D3D10CreateBlob');
// NumBytes : UINT_PTR -> UintPtr
// ppBuffer : ID3DBlob** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function D3D10CreateBlob(
NumBytes: NativeUInt; // UINT_PTR
ppBuffer: Pointer // ID3DBlob** out
): Integer; stdcall;
external 'd3d10.dll' name 'D3D10CreateBlob';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "D3D10CreateBlob"
c_D3D10CreateBlob :: CUIntPtr -> Ptr () -> IO Int32
-- NumBytes : UINT_PTR -> CUIntPtr
-- ppBuffer : ID3DBlob** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let d3d10createblob =
foreign "D3D10CreateBlob"
(size_t @-> (ptr void) @-> returning int32_t)
(* NumBytes : UINT_PTR -> size_t *)
(* ppBuffer : ID3DBlob** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library d3d10 (t "d3d10.dll"))
(cffi:use-foreign-library d3d10)
(cffi:defcfun ("D3D10CreateBlob" d3-d10-create-blob :convention :stdcall) :int32
(num-bytes :uint64) ; UINT_PTR
(pp-buffer :pointer)) ; ID3DBlob** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $D3D10CreateBlob = Win32::API::More->new('d3d10',
'int D3D10CreateBlob(WPARAM NumBytes, LPVOID ppBuffer)');
# my $ret = $D3D10CreateBlob->Call($NumBytes, $ppBuffer);
# NumBytes : UINT_PTR -> WPARAM
# ppBuffer : ID3DBlob** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型