ホーム › System.Ole › VarR8FromI2
VarR8FromI2
関数SHORT値をDOUBLE(倍精度浮動小数点数)に変換する。
シグネチャ
// OLEAUT32.dll
#include <windows.h>
HRESULT VarR8FromI2(
SHORT sIn,
DOUBLE* pdblOut
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| sIn | SHORT | in |
| pdblOut | DOUBLE* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLEAUT32.dll
#include <windows.h>
HRESULT VarR8FromI2(
SHORT sIn,
DOUBLE* pdblOut
);[DllImport("OLEAUT32.dll", ExactSpelling = true)]
static extern int VarR8FromI2(
short sIn, // SHORT
out double pdblOut // DOUBLE* out
);<DllImport("OLEAUT32.dll", ExactSpelling:=True)>
Public Shared Function VarR8FromI2(
sIn As Short, ' SHORT
<Out> ByRef pdblOut As Double ' DOUBLE* out
) As Integer
End Function' sIn : SHORT
' pdblOut : DOUBLE* out
Declare PtrSafe Function VarR8FromI2 Lib "oleaut32" ( _
ByVal sIn As Integer, _
ByRef pdblOut As Double) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
VarR8FromI2 = ctypes.windll.oleaut32.VarR8FromI2
VarR8FromI2.restype = ctypes.c_int
VarR8FromI2.argtypes = [
ctypes.c_short, # sIn : SHORT
ctypes.POINTER(ctypes.c_double), # pdblOut : DOUBLE* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLEAUT32.dll')
VarR8FromI2 = Fiddle::Function.new(
lib['VarR8FromI2'],
[
Fiddle::TYPE_SHORT, # sIn : SHORT
Fiddle::TYPE_VOIDP, # pdblOut : DOUBLE* out
],
Fiddle::TYPE_INT)#[link(name = "oleaut32")]
extern "system" {
fn VarR8FromI2(
sIn: i16, // SHORT
pdblOut: *mut f64 // DOUBLE* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLEAUT32.dll")]
public static extern int VarR8FromI2(short sIn, out double pdblOut);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLEAUT32_VarR8FromI2' -Namespace Win32 -PassThru
# $api::VarR8FromI2(sIn, pdblOut)#uselib "OLEAUT32.dll"
#func global VarR8FromI2 "VarR8FromI2" sptr, sptr
; VarR8FromI2 sIn, varptr(pdblOut) ; 戻り値は stat
; sIn : SHORT -> "sptr"
; pdblOut : DOUBLE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "OLEAUT32.dll" #cfunc global VarR8FromI2 "VarR8FromI2" int, var ; res = VarR8FromI2(sIn, pdblOut) ; sIn : SHORT -> "int" ; pdblOut : DOUBLE* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "OLEAUT32.dll" #cfunc global VarR8FromI2 "VarR8FromI2" int, sptr ; res = VarR8FromI2(sIn, varptr(pdblOut)) ; sIn : SHORT -> "int" ; pdblOut : DOUBLE* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT VarR8FromI2(SHORT sIn, DOUBLE* pdblOut) #uselib "OLEAUT32.dll" #cfunc global VarR8FromI2 "VarR8FromI2" int, var ; res = VarR8FromI2(sIn, pdblOut) ; sIn : SHORT -> "int" ; pdblOut : DOUBLE* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT VarR8FromI2(SHORT sIn, DOUBLE* pdblOut) #uselib "OLEAUT32.dll" #cfunc global VarR8FromI2 "VarR8FromI2" int, intptr ; res = VarR8FromI2(sIn, varptr(pdblOut)) ; sIn : SHORT -> "int" ; pdblOut : DOUBLE* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
oleaut32 = windows.NewLazySystemDLL("OLEAUT32.dll")
procVarR8FromI2 = oleaut32.NewProc("VarR8FromI2")
)
// sIn (SHORT), pdblOut (DOUBLE* out)
r1, _, err := procVarR8FromI2.Call(
uintptr(sIn),
uintptr(pdblOut),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction VarR8FromI2(
sIn: Smallint; // SHORT
pdblOut: Pointer // DOUBLE* out
): Integer; stdcall;
external 'OLEAUT32.dll' name 'VarR8FromI2';result := DllCall("OLEAUT32\VarR8FromI2"
, "Short", sIn ; SHORT
, "Ptr", pdblOut ; DOUBLE* out
, "Int") ; return: HRESULT●VarR8FromI2(sIn, pdblOut) = DLL("OLEAUT32.dll", "int VarR8FromI2(int, void*)")
# 呼び出し: VarR8FromI2(sIn, pdblOut)
# sIn : SHORT -> "int"
# pdblOut : DOUBLE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。