ホーム › System.MessageQueuing › MQFreeMemory
MQFreeMemory
関数MSMQが割り当てたメモリを解放する。
シグネチャ
// mqrt.dll
#include <windows.h>
void MQFreeMemory(
void* pvMemory
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pvMemory | void* | in | MSMQ APIが内部割り当てしたメモリブロックへのポインタ。これを解放する。 |
戻り値の型: void
各言語での呼び出し定義
// mqrt.dll
#include <windows.h>
void MQFreeMemory(
void* pvMemory
);[DllImport("mqrt.dll", ExactSpelling = true)]
static extern void MQFreeMemory(
IntPtr pvMemory // void*
);<DllImport("mqrt.dll", ExactSpelling:=True)>
Public Shared Sub MQFreeMemory(
pvMemory As IntPtr ' void*
)
End Sub' pvMemory : void*
Declare PtrSafe Sub MQFreeMemory Lib "mqrt" ( _
ByVal pvMemory As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MQFreeMemory = ctypes.windll.mqrt.MQFreeMemory
MQFreeMemory.restype = None
MQFreeMemory.argtypes = [
ctypes.POINTER(None), # pvMemory : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mqrt.dll')
MQFreeMemory = Fiddle::Function.new(
lib['MQFreeMemory'],
[
Fiddle::TYPE_VOIDP, # pvMemory : void*
],
Fiddle::TYPE_VOID)#[link(name = "mqrt")]
extern "system" {
fn MQFreeMemory(
pvMemory: *mut () // void*
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("mqrt.dll")]
public static extern void MQFreeMemory(IntPtr pvMemory);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mqrt_MQFreeMemory' -Namespace Win32 -PassThru
# $api::MQFreeMemory(pvMemory)#uselib "mqrt.dll"
#func global MQFreeMemory "MQFreeMemory" sptr
; MQFreeMemory pvMemory
; pvMemory : void* -> "sptr"#uselib "mqrt.dll"
#func global MQFreeMemory "MQFreeMemory" sptr
; MQFreeMemory pvMemory
; pvMemory : void* -> "sptr"; void MQFreeMemory(void* pvMemory)
#uselib "mqrt.dll"
#func global MQFreeMemory "MQFreeMemory" intptr
; MQFreeMemory pvMemory
; pvMemory : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mqrt = windows.NewLazySystemDLL("mqrt.dll")
procMQFreeMemory = mqrt.NewProc("MQFreeMemory")
)
// pvMemory (void*)
r1, _, err := procMQFreeMemory.Call(
uintptr(pvMemory),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure MQFreeMemory(
pvMemory: Pointer // void*
); stdcall;
external 'mqrt.dll' name 'MQFreeMemory';result := DllCall("mqrt\MQFreeMemory"
, "Ptr", pvMemory ; void*
, "Int") ; return: void●MQFreeMemory(pvMemory) = DLL("mqrt.dll", "int MQFreeMemory(void*)")
# 呼び出し: MQFreeMemory(pvMemory)
# pvMemory : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "mqrt" fn MQFreeMemory(
pvMemory: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) void;proc MQFreeMemory(
pvMemory: pointer # void*
) {.importc: "MQFreeMemory", stdcall, dynlib: "mqrt.dll".}pragma(lib, "mqrt");
extern(Windows)
void MQFreeMemory(
void* pvMemory // void*
);ccall((:MQFreeMemory, "mqrt.dll"), stdcall, Cvoid,
(Ptr{Cvoid},),
pvMemory)
# pvMemory : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void MQFreeMemory(
void* pvMemory);
]]
local mqrt = ffi.load("mqrt")
-- mqrt.MQFreeMemory(pvMemory)
-- pvMemory : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('mqrt.dll');
const MQFreeMemory = lib.func('__stdcall', 'MQFreeMemory', 'void', ['void *']);
// MQFreeMemory(pvMemory)
// pvMemory : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("mqrt.dll", {
MQFreeMemory: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.MQFreeMemory(pvMemory)
// pvMemory : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void MQFreeMemory(
void* pvMemory);
C, "mqrt.dll");
// $ffi->MQFreeMemory(pvMemory);
// pvMemory : void*
// 構造体/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 Mqrt extends StdCallLibrary {
Mqrt INSTANCE = Native.load("mqrt", Mqrt.class);
void MQFreeMemory(
Pointer pvMemory // void*
);
}@[Link("mqrt")]
lib Libmqrt
fun MQFreeMemory = MQFreeMemory(
pvMemory : Void* # void*
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MQFreeMemoryNative = Void Function(Pointer<Void>);
typedef MQFreeMemoryDart = void Function(Pointer<Void>);
final MQFreeMemory = DynamicLibrary.open('mqrt.dll')
.lookupFunction<MQFreeMemoryNative, MQFreeMemoryDart>('MQFreeMemory');
// pvMemory : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure MQFreeMemory(
pvMemory: Pointer // void*
); stdcall;
external 'mqrt.dll' name 'MQFreeMemory';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MQFreeMemory"
c_MQFreeMemory :: Ptr () -> IO ()
-- pvMemory : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let mqfreememory =
foreign "MQFreeMemory"
((ptr void) @-> returning void)
(* pvMemory : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mqrt (t "mqrt.dll"))
(cffi:use-foreign-library mqrt)
(cffi:defcfun ("MQFreeMemory" mqfree-memory :convention :stdcall) :void
(pv-memory :pointer)) ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MQFreeMemory = Win32::API::More->new('mqrt',
'void MQFreeMemory(LPVOID pvMemory)');
# my $ret = $MQFreeMemory->Call($pvMemory);
# pvMemory : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。