PC Review


Reply
Thread Tools Rate Thread

Calling VC++ From VB.NET

 
 
Mark Jerde
Guest
Posts: n/a
 
      28th Feb 2005
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


 
Reply With Quote
 
 
 
 
bonj
Guest
Posts: n/a
 
      1st Mar 2005
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


 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q3JvdWNoaWUxOTk4?=
Guest
Posts: n/a
 
      1st Mar 2005
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
 
Reply With Quote
 
Mark Jerde
Guest
Posts: n/a
 
      1st Mar 2005
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


 
Reply With Quote
 
bonj
Guest
Posts: n/a
 
      1st Mar 2005
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!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling DoCmd.RunCommand acCmdSaveRecord, after calling an API function Savvoulidis Iordanis Microsoft Access Form Coding 2 19th Mar 2005 07:34 PM
Fail to send fax when making international fax calling / calling c =?Utf-8?B?c2Ftd2lzZQ==?= Windows XP Help 1 28th Dec 2004 03:31 PM
Calling FormsAuthentication.SignOut() after calling Response.Flush =?Utf-8?B?TWFydGluIExlZQ==?= Microsoft ASP .NET 1 28th Sep 2004 01:47 PM
Calling an attribute method before calling a method with that attribute George Vodpik Microsoft Dot NET 0 9th Aug 2004 11:37 PM
Server Side button calling page_load before calling it's own click event. Ryan Ternier Microsoft ASP .NET 4 29th Jul 2004 02:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:53 AM.