Home | Index | Dotnet4all Snippets | Submit resources
About | Mail us 





VB Calling a C or C++ Function? (Saturday, August 28, 2004)



Found the following interesting discussion in the Newsgroups:

VB Calling a C or C++ Function?
by:Anonymous

I have written an Extensive test application in VB and long and detailed Algorithm that the application stresses and tests. The problem is that now that I have the algorithm perfected, I had to re-write it in C++. And since the algorithm, which is a function accepting three values (byval) and returning one, is going to be used in an embedded application I need to test the C function to same degree that I have tested the VB function before I release it.

How do I call a C or C++ function in VB.NET? Doesn't the .NET frame work make this easier without having to write a complicated COM wrapper?
Randy
Randy.york@baesystems


 Reply:
by:yEaH rIgHt

 Is this function in a dll? If so, use Platform Invoke.


 Reply:
by:Anonymous

 No, its a seperte .cpp file.


 Reply:
by:yEaH rIgHt

 It must be put in a dll if you eant to use it.


 Reply:
by:Brian Henry

 a cpp file is an uncompiled file, along with .h header files.. you must compile them first into a windows dynamic link library (DLL) then you can use them by doing PInvoke DLLImport calls in your vb.net application



Posted by Xander Zelders



0 Comments:

Post a Comment

<< Home

 
Previous Posts
    - Getting Information From the Browser...
    - How to use VB.NET to access the "IE history folder...
    - How to print a .rtf File (containing text & graphi...
    - Is there an HTML web form component?
    - Get filenames
    - Simple Datagrid question
    - How to quit an excel object
    - Saving ANSI Character into SQL Server's varchar fi...
    - How to play a song with VB.NET
    - Dropdown Form menu.



Disclaimer & Terms of Use | DotNet4All.Com concept & © 2004 - 2007 by Zelders² - Holland