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

ber_bvfree

関数
berval構造体を解放する。
DLLWLDAP32.dll呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

// WLDAP32.dll
#include <windows.h>

void ber_bvfree(
    LDAP_BERVAL* bv
);

パラメーター

名前方向説明
bvLDAP_BERVAL*inout解放するberval構造体ポインタ。BER値とその内部バッファを解放する。NULL可。

戻り値の型: void

各言語での呼び出し定義

// WLDAP32.dll
#include <windows.h>

void ber_bvfree(
    LDAP_BERVAL* bv
);
[DllImport("WLDAP32.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ber_bvfree(
    IntPtr bv   // LDAP_BERVAL* in/out
);
<DllImport("WLDAP32.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ber_bvfree(
    bv As IntPtr   ' LDAP_BERVAL* in/out
)
End Sub
' bv : LDAP_BERVAL* in/out
Declare PtrSafe Sub ber_bvfree Lib "wldap32" ( _
    ByVal bv As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ber_bvfree = ctypes.cdll.wldap32.ber_bvfree
ber_bvfree.restype = None
ber_bvfree.argtypes = [
    ctypes.c_void_p,  # bv : LDAP_BERVAL* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WLDAP32.dll')
ber_bvfree = Fiddle::Function.new(
  lib['ber_bvfree'],
  [
    Fiddle::TYPE_VOIDP,  # bv : LDAP_BERVAL* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "wldap32")]
extern "C" {
    fn ber_bvfree(
        bv: *mut LDAP_BERVAL  // LDAP_BERVAL* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WLDAP32.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void ber_bvfree(IntPtr bv);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_ber_bvfree' -Namespace Win32 -PassThru
# $api::ber_bvfree(bv)
#uselib "WLDAP32.dll"
#func global ber_bvfree "ber_bvfree" sptr
; ber_bvfree varptr(bv)
; bv : LDAP_BERVAL* in/out -> "sptr"
出力引数:
#uselib "WLDAP32.dll"
#func global ber_bvfree "ber_bvfree" var
; ber_bvfree bv
; bv : LDAP_BERVAL* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void ber_bvfree(LDAP_BERVAL* bv)
#uselib "WLDAP32.dll"
#func global ber_bvfree "ber_bvfree" var
; ber_bvfree bv
; bv : LDAP_BERVAL* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procber_bvfree = wldap32.NewProc("ber_bvfree")
)

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

extern "wldap32" fn ber_bvfree(
    bv: [*c]LDAP_BERVAL // LDAP_BERVAL* in/out
) callconv(.c) void;
proc ber_bvfree(
    bv: ptr LDAP_BERVAL  # LDAP_BERVAL* in/out
) {.importc: "ber_bvfree", cdecl, dynlib: "WLDAP32.dll".}
pragma(lib, "wldap32");
extern(C)
void ber_bvfree(
    LDAP_BERVAL* bv   // LDAP_BERVAL* in/out
);
ccall((:ber_bvfree, "WLDAP32.dll"), Cvoid,
      (Ptr{LDAP_BERVAL},),
      bv)
# bv : LDAP_BERVAL* in/out -> Ptr{LDAP_BERVAL}
local ffi = require("ffi")
ffi.cdef[[
void ber_bvfree(
    void* bv);
]]
local wldap32 = ffi.load("wldap32")
-- wldap32.ber_bvfree(bv)
-- bv : LDAP_BERVAL* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WLDAP32.dll');
const ber_bvfree = lib.func('__cdecl', 'ber_bvfree', 'void', ['void *']);
// ber_bvfree(bv)
// bv : LDAP_BERVAL* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WLDAP32.dll", {
  ber_bvfree: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.ber_bvfree(bv)
// bv : LDAP_BERVAL* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void ber_bvfree(
    void* bv);
C, "WLDAP32.dll");
// $ffi->ber_bvfree(bv);
// bv : LDAP_BERVAL* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Wldap32 extends Library {
    Wldap32 INSTANCE = Native.load("wldap32", Wldap32.class);
    void ber_bvfree(
        Pointer bv   // LDAP_BERVAL* in/out
    );
}
@[Link("wldap32")]
lib LibWLDAP32
  fun ber_bvfree = ber_bvfree(
    bv : LDAP_BERVAL*   # LDAP_BERVAL* in/out
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ber_bvfreeNative = Void Function(Pointer<Void>);
typedef ber_bvfreeDart = void Function(Pointer<Void>);
final ber_bvfree = DynamicLibrary.open('WLDAP32.dll')
    .lookupFunction<ber_bvfreeNative, ber_bvfreeDart>('ber_bvfree');
// bv : LDAP_BERVAL* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure ber_bvfree(
  bv: Pointer   // LDAP_BERVAL* in/out
); cdecl;
  external 'WLDAP32.dll' name 'ber_bvfree';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ber_bvfree"
  c_ber_bvfree :: Ptr () -> IO ()
-- bv : LDAP_BERVAL* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ber_bvfree =
  foreign "ber_bvfree"
    ((ptr void) @-> returning void)
(* bv : LDAP_BERVAL* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wldap32 (t "WLDAP32.dll"))
(cffi:use-foreign-library wldap32)

(cffi:defcfun ("ber_bvfree" ber-bvfree :convention :cdecl) :void
  (bv :pointer))   ; LDAP_BERVAL* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ber_bvfree = Win32::API::More->new('WLDAP32',
    'void ber_bvfree(LPVOID bv)');
# my $ret = $ber_bvfree->Call($bv);
# bv : LDAP_BERVAL* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型