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