473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Calling VC++ From VB.NET

I have been searching google, google groups and MSDN but haven't found any
simple examples yet. Suggestions and/or URLs would be appreciated!

I need to write some ISO C++ functions to verify data streams. (It is
expected these will also eventually be run in Linux.) The application also
needs a management GUI. For Windows I plan to write the GUI in VB .NET
2003.

How do I call C++ from VB.NET? I'm trying to start small:

bool AlwaysReturnsTrue(void)

and work up to:

bool StreamIsValid(IN ByteArray, IN Length, OUT ErrorMessage, OUT ErrorByte)
I'm uncertain about memory issues: Who allocates, etc. I'm also unclear
about internalization of the error messages.

Thanks.

-- Mark
Nov 21 '05 #1
4 1003
On Mon, 28 Feb 2005 12:39:02 -0500, Mark Jerde spooled the following
warez:
I have been searching google, google groups and MSDN but haven't found any
simple examples yet. Suggestions and/or URLs would be appreciated!

I need to write some ISO C++ functions to verify data streams. (It is
expected these will also eventually be run in Linux.) The application also
needs a management GUI. For Windows I plan to write the GUI in VB .NET
2003.
Why don't you write it in java, then you won't even have to write a
different one for linux.

How do I call C++ from VB.NET? I'm trying to start small:
Use Declare.

bool AlwaysReturnsTrue(void)

and work up to:

bool StreamIsValid(IN ByteArray, IN Length, OUT ErrorMessage, OUT ErrorByte)
Read up on System.InteropServices.Marshal et al.


I'm uncertain about memory issues: Who allocates, etc. I'm also unclear
about internalization of the error messages.
Caller allocates. .NET also has some 'magic' classes such as
StringBuilder that can be 'passed to be filled' without having a maximum
size pre-specified - this is done by the GC.


Thanks.

-- Mark


Nov 21 '05 #2
I wrote a simple C++ DLL & called it from VB.NET. Here's the sample:

http://www.gotdotnet.com/Community/U...2-ca46ef086c12

I hope this will help
Nov 21 '05 #3
bonj wrote:
I need to write some ISO C++ functions to verify data streams. (It
is expected these will also eventually be run in Linux.) The
application also needs a management GUI. For Windows I plan to
write the GUI in VB .NET 2003.


Why don't you write it in java, then you won't even have to write a
different one for linux.


I don't know Java... ;-) I installed Eclipse but couldn't get the
examples to run. I also installed Borland's free Java IDE and it works but
Java looks to have quite a learning curve. I wrote a lot of VB5/6 code and
have written a few small VB.NET programs. (Nested classes are great!) For
now I want to stay with something I (sorta) know.

-- Mark
Nov 21 '05 #4
On Tue, 01 Mar 2005 08:16:26 -0500, Mark Jerde spooled the following
warez:
bonj wrote:
I need to write some ISO C++ functions to verify data streams. (It
is expected these will also eventually be run in Linux.) The
application also needs a management GUI. For Windows I plan to
write the GUI in VB .NET 2003.
Why don't you write it in java, then you won't even have to write a
different one for linux.


I don't know Java...

Neither do I, but it doesn't stop me ;-)
I installed Eclipse but couldn't get the examples to run. I also installed Borland's free Java IDE and it works
but Java looks to have quite a learning curve.
Install the Java SDK from sun.java.com. There's also the netbeans IDE,
but I find it poor and don't use it. The way I see it, it's more fun
to learn what has to be learnt to get what I want done than it is to write
the same logic twice.
I wrote a lot of VB5/6
code and have written a few small VB.NET programs. (Nested classes are
great!) For now I want to stay with something I (sorta) know.


Java is very similar to C#. And C# is very similar to VB.NET (sort of).
But you need to ask yourself, do you want a GUI to be able to run on
linux? If you do, and you already know a language / libraries to do that,
then you're sorted - go with your original plan. Or maybe you only need
the GUI on windows. But all I was thinking was, if it's more a case of
"I'll cross that bridge when I come to it" for the GUI on linux, then you
might end up finding that java is the best option anyway - and you'll kick
yourself if you've already spent ages writing a program in .NET on windows.

good luck with it though whatever you decide!
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: RainBow | last post by:
Hi everyone, (Very Sorry, if this is the wrong group in which I am posting this query). Code snippet: //C library typedef int (*PFunc)(int* aArg); void call_c_foo(PFunc aPtrtoFunc) {
1
by: dwp | last post by:
hResult = pDefaultDomain->CreateInstanceFrom( pAppDomain- >m_bstrLoadAssemblyName, pAppDomain->m_bstrManagedClass, &pObjectHandle ) This call gives the E_ACCESSDENIED return value. I have...
1
by: Mark Jerde | last post by:
Yesterday I posted the message below to microsoft.public.dotnet.languages.vb and microsoft.public.vc.language. The two replies are also posted. I need to write some ISO C++ functions, more...
1
by: Jesse McGrew | last post by:
Hi all, I'm trying to make a plugin DLL for a third-party application, using VC++ .NET 2003. This DLL acts as a bridge between the C++ plugin API of the application, and my actual plugin code...
17
by: Bill Grigg | last post by:
I have been successfully calling DLL's using VC++ 6.0 and also using VC++7.1 (.NET). I only mention this because I have never felt comfortable with the process, but nonetheless it did work....
1
by: Bern McCarty | last post by:
What do you make of this? I cannot tell for sure but it almost seems as the the transition thunk to get back from the native bool method to the managed caller is looking at eax and, if any bit is...
16
by: teju | last post by:
hi, i am trying 2 merge 2 projects into one project.One project is using c language and the other one is using c++ code. both are working very fine independently.But now i need to merge both...
16
by: Jaco Naude | last post by:
Hi there, This is my first post over here and I hope someone can give me some guidance. I'm trying to embed Python into a Visual C++ 2008 application and I'm getting linker problems. I've...
6
by: Ole Nielsby | last post by:
VC has a __cdecl specifier which allows functions and methods to be called with varying parameter count. (I understand this is the default for functions in general but in VC, instances use...
1
by: Clint Jensen | last post by:
Hello, I had a working project creating in Visual Studio 2003 where a VC++ program was calling a DLL produced by VB built using VS 2003. We recently upgraded to VS 2005 and calling the VB DLL...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.