none
How to change the calling convention for a VB.net project in VS 2017 RRS feed

  • Question

  • I received a DLL from a vendor that won't work with my VB.net program in Windows 10 on a 64-bit processor. The vendor tells me I need to change the target CPU to x86  which I have already done. They also say I need to change the calling convention to to "__stdcall"  ( rather than "__fastcall" or "__cdecl")

    How is that done in VS 20127?


    PickyBiker

    Thursday, January 18, 2018 7:04 PM

All replies

  • CallingConvention is an atribute of DllImport

    DllImportAttribute.CallingConvention

    For example  :

    <DllImport("Kernel32.dll", EntryPoint:="MoveFileW", SetLastError:=True, CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function MoveFile(lpExistingFileName As String, lpNewFileName As String) As Boolean
        End Function

    Thursday, January 18, 2018 7:17 PM
  • I think this is more a question for the VB.Net forum

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral

    Maybe is your base VB6 and the most important change between VB6 and VB7 was beside from Com to Net that the Integer types were shifted. 


    Success Cor


    Thursday, January 18, 2018 7:44 PM
  • Hi PickyBiker,

    Welcome to the MSDN forum.

    Refer to your description, your issue is about VB.NET development. Since our forum is to discuss the VS IDE, I will help you move this thread to the appropriate forum for a better support, thank you for your understanding.

    Best regards,

    Sara


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, January 19, 2018 1:58 AM