Re: Best way to use static method functions from MC++ lib in VB.NET
From: Joe Delekto (jfalcon_at_mindspring.com)
Date: 03/18/04
- Previous message: Rudy Ray Moore: "Re: Slow compile until reboot"
- In reply to: Rob: "Best way to use static method functions from MC++ lib in VB.NET"
- Next in thread: William DePalo [MVP VC++]: "Re: Best way to use static method functions from MC++ lib in VB.NET"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 17 Mar 2004 20:43:17 -0500
Greets,
While I've not run across it, there may be a way to make one of your
class library DLLs automatically referenced by the Visual Studio .NET IDE.
Certain project types add references to other .NET DLLs (such as the
System.Web.dll), so perhaps you could create a custom project type that adds
your control library. (Note that if you create, say, a console application,
you have to add that reference yourself.)
This is definitely not recommended (i.e. don't do it for production
code!), but one MC++ project I worked on used the System namespace to
declare a "ConsoleEx" class with static members that were meant to augment
the .NET Framework Console functions. It would definitely be frowned upon
for a production release, especially if there were ever a class with that
name to be added to the framework, but it worked for me nonetheless. (I
only used it for internal testing as a way to 'cheat' without needing a
'using' statement specifically for that class.)
As far as multi-threading is concerned, you only have an issue if you
have static data members which are accessed by your static member functions.
In that case, you would have to lock access to them between threads. If,
however, you take all your parameters to your static member functions and
create any interim objects and data internally (without any static members
or variables [i.e. everything on the stack or heap and not shared between
threads]) then you should have no problems running in a multi-threaded
environment without any special synchronization considerations.
Regards,
Joe
"Rob" <anonymous@discussions.microsoft.com> wrote in message
news:08B3867B-35E7-46E8-B630-E8C3AC915BE6@microsoft.com...
> I've created a MC++ library with a class that contains some static method
functions.
>
> I create a reference to the library from a VB.NET application and I can
> call the functions with no problems.
>
> I'm wondering if there is an alternative to creating a reference to the
dll or assembly?
> Is there a way to register a namespace in MC++ or VB.NET so that my class
works like standard
> base classes such as the Systems class using the imports statement in the
VB.NET app?
>
> I'm looking for a way to make the static class as easy to use as possible
> Do namespaces have an advantage over using the add reference feature?
>
> Also, I wonder if there is any impact on support for multi-threading if I
make my
> class method functions static?
- Previous message: Rudy Ray Moore: "Re: Slow compile until reboot"
- In reply to: Rob: "Best way to use static method functions from MC++ lib in VB.NET"
- Next in thread: William DePalo [MVP VC++]: "Re: Best way to use static method functions from MC++ lib in VB.NET"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|