Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID


We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

C++ with VB.NET

Pulsar79Pulsar79 Posts: 3Member
Good boys.

Look, I realize a program of powerful enough management. It realizes mathematical calculations and uses many geometry. The topic is that I have the interface of the program in Visual Basic .NET but for the algorithms I want to use C ++ or C pure. Then I want to communicate the program in Visual with these algorithms in C that will return to him results of calculations of triangulation, volumes, profiles of terrains, etc., some rapid calculations, others can be late 10 minutes or more.

Some calculations I need to load a lot of information before realizing them, and then to do calls asking for the same calculation, for what I need that these algorithms stay with certain resident variables in memory, for what P/Invoke's use does not convince me.

I have several options to communicate, to see if you recommend to me the best:

* By means of a local socket, and to use a protocol of commands
* To do the processes in C ++ as services
* Communication between processes (MPI?)
* P/Invoke, though I believe that this does not serve me completely
* C ++/CLI
* Does someone happen to you more?

Thank you for your attention.


  • LundinLundin Posts: 3,711Member
    None of those. To make a DLL in C and call it from VB works great.
  • Pulsar79Pulsar79 Posts: 3Member
    Yes... P/Invoke, you say. But... this goes well when you have a function and pass the parameters, but if you have to pass parameters that they are large (list of 500.000 points, etc.), this consumes time, and i need that the parameters stay in the memory of the program in C in the first call. Can i use pointers?
  • LundinLundin Posts: 3,711Member
    I see no reason why you would pass that by value no matter language. You should be able to pass the values to the DLL through "ByRef", if you even need to allocate them in VB in the first place.

    If VB is only there for GUI stuff, then you really don't need to store anything at all in VB. Allocate everything in the DLL and let VB call various functions.
  • Pulsar79Pulsar79 Posts: 3Member
    Yes, I consider that you say is a good option. I believe that I will use P/Invoke for to do calls. Do you know any document (web, pdf, etc) where I can learn P/Invoke well?

  • LundinLundin Posts: 3,711Member
    I don't even know what that is. Simply use the Win API functions. And VB has a simple syntax for declaring functions located in a DLL, although that syntax may vary depending on VB version (as that whole frigging language does). I avoid VB entirely myself.
Sign In or Register to comment.