DllImportAttribute.CallingConvention フィールドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DllImportAttribute.CallingConvention フィールドの意味・解説 

DllImportAttribute.CallingConvention フィールド

エントリ ポイント呼び出し規約示します

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

解説解説
使用例使用例

Visual Basic開発者は、マネージ コードDLL 関数定義する際、Declare ステートメント代わりに、DllImportAttribute を使用することがありますCallingConvention フィールドの設定は、このような事例1 つです。

Imports System
 Imports Microsoft.VisualBasic
 Imports System.Runtime.InteropServices
 Public Class LibWrap
 ' Visual Basic does not support varargs, so all arguments must be 
 ' explicitly defined. CallingConvention.Cdecl must be used since the
 stack 
 ' is cleaned up by the caller.
 ' int printf(const char *format [, argument]...)
 <DllImport("msvcrt.dll", CallingConvention :=
 CallingConvention.Cdecl)> _
 Overloads Shared Function
 printf (_
     format As String, i As
 Integer, d As Double)
 As Integer
 End Function
 <DllImport("msvcrt.dll", CallingConvention :=
 CallingConvention.Cdecl)> _
 Overloads Shared Function
 printf (_
     format As String, i As
 Integer, s As String)
 As Integer
 End Function
 End Class 'LibWrap
 Public Class App
     Public Shared Sub Main()
         LibWrap.printf(ControlChars.CrLf + "Print params: %i
 %f", 99, 
                        99.99)
         LibWrap.printf(ControlChars.CrLf + "Print params: %i
 %s", 99, _
                        "abcd")
     End Sub 'Main
 End Class 'App
using System;
 using System.Runtime.InteropServices;
 public class LibWrap
 {
 // C# doesn't support varargs so all arguments must be explicitly defined.
 // CallingConvention.Cdecl must be used since the stack is 
 // cleaned up by the caller.
 // int printf(const char *format [, argument]...)
 [DllImport("msvcrt.dll", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl)]
 public static extern int
 printf(String format, int i, double d); 
 [DllImport("msvcrt.dll", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl)]
 public static extern int
 printf(String format, int i, String s); 
 }
 public class App
 {
     public static void
 Main()
     {
         LibWrap.printf("\nPrint params: %i %f", 99, 99.99);
         LibWrap.printf("\nPrint params: %i %s", 99, "abcd");
     }
 }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DllImportAttribute クラス
DllImportAttribute メンバ
System.Runtime.InteropServices 名前空間
CallingConvention 列挙


このページでは「.NET Framework クラス ライブラリ リファレンス」からDllImportAttribute.CallingConvention フィールドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDllImportAttribute.CallingConvention フィールドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDllImportAttribute.CallingConvention フィールド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

DllImportAttribute.CallingConvention フィールドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DllImportAttribute.CallingConvention フィールドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS