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

WsFreeChannel

関数
チャネルを解放する。
DLLwebservices.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

void WsFreeChannel(
    WS_CHANNEL* channel
);

パラメーター

名前方向説明
channelWS_CHANNEL*in解放して破棄する対象のチャネル。

戻り値の型: void

各言語での呼び出し定義

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

void WsFreeChannel(
    WS_CHANNEL* channel
);
[DllImport("webservices.dll", ExactSpelling = true)]
static extern void WsFreeChannel(
    ref IntPtr channel   // WS_CHANNEL*
);
<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Sub WsFreeChannel(
    ByRef channel As IntPtr   ' WS_CHANNEL*
)
End Sub
' channel : WS_CHANNEL*
Declare PtrSafe Sub WsFreeChannel Lib "webservices" ( _
    ByRef channel As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WsFreeChannel = ctypes.windll.webservices.WsFreeChannel
WsFreeChannel.restype = None
WsFreeChannel.argtypes = [
    ctypes.c_void_p,  # channel : WS_CHANNEL*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	webservices = windows.NewLazySystemDLL("webservices.dll")
	procWsFreeChannel = webservices.NewProc("WsFreeChannel")
)

// channel (WS_CHANNEL*)
r1, _, err := procWsFreeChannel.Call(
	uintptr(channel),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure WsFreeChannel(
  channel: Pointer   // WS_CHANNEL*
); stdcall;
  external 'webservices.dll' name 'WsFreeChannel';
result := DllCall("webservices\WsFreeChannel"
    , "Ptr", channel   ; WS_CHANNEL*
    , "Int")   ; return: void
●WsFreeChannel(channel) = DLL("webservices.dll", "int WsFreeChannel(void*)")
# 呼び出し: WsFreeChannel(channel)
# channel : WS_CHANNEL* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "webservices" fn WsFreeChannel(
    channel: [*c]isize // WS_CHANNEL*
) callconv(std.os.windows.WINAPI) void;
proc WsFreeChannel(
    channel: ptr int  # WS_CHANNEL*
) {.importc: "WsFreeChannel", stdcall, dynlib: "webservices.dll".}
pragma(lib, "webservices");
extern(Windows)
void WsFreeChannel(
    ptrdiff_t* channel   // WS_CHANNEL*
);
ccall((:WsFreeChannel, "webservices.dll"), stdcall, Cvoid,
      (Ptr{Int},),
      channel)
# channel : WS_CHANNEL* -> Ptr{Int}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void WsFreeChannel(
    intptr_t* channel);
]]
local webservices = ffi.load("webservices")
-- webservices.WsFreeChannel(channel)
-- channel : WS_CHANNEL*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('webservices.dll');
const WsFreeChannel = lib.func('__stdcall', 'WsFreeChannel', 'void', ['intptr_t *']);
// WsFreeChannel(channel)
// channel : WS_CHANNEL* -> 'intptr_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("webservices.dll", {
  WsFreeChannel: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.WsFreeChannel(channel)
// channel : WS_CHANNEL* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void WsFreeChannel(
    intptr_t* channel);
C, "webservices.dll");
// $ffi->WsFreeChannel(channel);
// channel : WS_CHANNEL*
// 構造体/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 Webservices extends StdCallLibrary {
    Webservices INSTANCE = Native.load("webservices", Webservices.class);
    void WsFreeChannel(
        LongByReference channel   // WS_CHANNEL*
    );
}
@[Link("webservices")]
lib Libwebservices
  fun WsFreeChannel = WsFreeChannel(
    channel : LibC::SSizeT*   # WS_CHANNEL*
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WsFreeChannelNative = Void Function(Pointer<IntPtr>);
typedef WsFreeChannelDart = void Function(Pointer<IntPtr>);
final WsFreeChannel = DynamicLibrary.open('webservices.dll')
    .lookupFunction<WsFreeChannelNative, WsFreeChannelDart>('WsFreeChannel');
// channel : WS_CHANNEL* -> Pointer<IntPtr>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure WsFreeChannel(
  channel: Pointer   // WS_CHANNEL*
); stdcall;
  external 'webservices.dll' name 'WsFreeChannel';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WsFreeChannel"
  c_WsFreeChannel :: Ptr CIntPtr -> IO ()
-- channel : WS_CHANNEL* -> Ptr CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let wsfreechannel =
  foreign "WsFreeChannel"
    ((ptr intptr_t) @-> returning void)
(* channel : WS_CHANNEL* -> (ptr intptr_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library webservices (t "webservices.dll"))
(cffi:use-foreign-library webservices)

(cffi:defcfun ("WsFreeChannel" ws-free-channel :convention :stdcall) :void
  (channel :pointer))   ; WS_CHANNEL*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WsFreeChannel = Win32::API::More->new('webservices',
    'void WsFreeChannel(LPVOID channel)');
# my $ret = $WsFreeChannel->Call($channel);
# channel : WS_CHANNEL* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。