C# DLL cannot affect value of a number passed by reference from a VB6 application

后端 未结 1 1048
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 15:28

I have a legacy VB6 application that calls a VB6 DLL, and I am trying to port the VB6 DLL to C# without yet touching the main VB6 application code. The old VB6 DLL had one

相关标签:
1条回答
  • 2020-11-30 15:47
    dll.Increment( num )
    

    Because you are using parentheses, the value is forcibly passed by value, not by reference (the compiler creates a temporary copy and passes that by reference).

    Remove the parentheses:

    dll.Increment num
    

    EDIT: A more complete explanation by MarkJ.

    0 讨论(0)
提交回复
热议问题