| 分類:[VB.NET/VB2005 以降]
環境:VB2015 OS:Windows7
ある機能をもったDLLが32ビット、64ビット2つ用意されています。 謎32.DLL(32ビット用DLL)、謎64.DLL(64ビット用DLL) どちらも同じ機能で、呼び出し関数も同じもの、引数も同じです。 これを動作環境によって切り替えたいのですが、可能でしょうか?
例というか、コードイメージ <DllImport("謎32.DLL", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl)> _ Function 関数A(ByVal cmd As Integer) As Integer End Function <DllImport("謎64.DLL", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl)> _ Function 関数A(ByVal cmd As Integer) As Integer End Function
If IntPtr.Size = 4 Then '32ビットで動作 ret = 関数A(1) '謎32.DLLでの関数A ElseIf IntPtr.Size = 8 Then ret = 関数A(1) '謎64.DLLでの関数A End If
こんな風にしたいです。
|