By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,953 Members | 1,109 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,953 IT Pros & Developers. It's quick & easy.

Calling VC++ From (C# | VB) .NET

P: n/a
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 information below. Is C# a
better language to use than VB.NET for calling these C++ functions? If so I
would appreciate some links on calling C++ from C#.

Thanks!

-- Mark
============= 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

============== bonj reply =============
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.

=============== Crouchie1998 reply ================

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 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I found a PInvoke example which looks to be what I need. Where can I find
information on parameter types, allocating memory, etc?

Thanks.

-- Mark

Mark Jerde wrote:
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 information below. Is
C# a better language to use than VB.NET for calling these C++
functions? If so I would appreciate some links on calling C++ from
C#.
Thanks!

-- Mark
============= 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

============== bonj reply =============
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.

=============== Crouchie1998 reply ================

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 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.