Win32 API 日本語リファレンス
ホームNetworking.Ldap › ldap_memfree

ldap_memfree

関数
LDAPが割り当てたメモリブロックを解放する。
DLLWLDAP32.dll文字セットANSI (-A)呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

// WLDAP32.dll  (ANSI / -A)
#include <windows.h>

void ldap_memfree(
    LPSTR Block
);

パラメーター

名前方向
BlockLPSTRin

戻り値の型: void

各言語での呼び出し定義

// WLDAP32.dll  (ANSI / -A)
#include <windows.h>

void ldap_memfree(
    LPSTR Block
);
[DllImport("WLDAP32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ldap_memfree(
    [MarshalAs(UnmanagedType.LPStr)] string Block   // LPSTR
);
<DllImport("WLDAP32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ldap_memfree(
    <MarshalAs(UnmanagedType.LPStr)> Block As String   ' LPSTR
)
End Sub
' Block : LPSTR
Declare PtrSafe Sub ldap_memfree Lib "wldap32" ( _
    ByVal Block As String)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ldap_memfree = ctypes.cdll.wldap32.ldap_memfree
ldap_memfree.restype = None
ldap_memfree.argtypes = [
    wintypes.LPCSTR,  # Block : LPSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WLDAP32.dll')
ldap_memfree = Fiddle::Function.new(
  lib['ldap_memfree'],
  [
    Fiddle::TYPE_VOIDP,  # Block : LPSTR
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "wldap32")]
extern "C" {
    fn ldap_memfree(
        Block: *mut u8  // LPSTR
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WLDAP32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern void ldap_memfree([MarshalAs(UnmanagedType.LPStr)] string Block);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_ldap_memfree' -Namespace Win32 -PassThru
# $api::ldap_memfree(Block)
#uselib "WLDAP32.dll"
#func global ldap_memfree "ldap_memfree" sptr
; ldap_memfree Block
; Block : LPSTR -> "sptr"
#uselib "WLDAP32.dll"
#func global ldap_memfree "ldap_memfree" str
; ldap_memfree Block
; Block : LPSTR -> "str"
; void ldap_memfree(LPSTR Block)
#uselib "WLDAP32.dll"
#func global ldap_memfree "ldap_memfree" str
; ldap_memfree Block
; Block : LPSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procldap_memfree = wldap32.NewProc("ldap_memfree")
)

// Block (LPSTR)
r1, _, err := procldap_memfree.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(Block))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure ldap_memfree(
  Block: PAnsiChar   // LPSTR
); cdecl;
  external 'WLDAP32.dll' name 'ldap_memfree';
result := DllCall("WLDAP32\ldap_memfree"
    , "AStr", Block   ; LPSTR
    , "Cdecl Int")   ; return: void
●ldap_memfree(Block) = DLL("WLDAP32.dll", "int ldap_memfree(char*)")
# 呼び出し: ldap_memfree(Block)
# Block : LPSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。