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