Re: Simple Managed DLL Creation

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Mark Prenter (sorry_at_toomuchspam.com)
Date: 07/13/04


Date: Tue, 13 Jul 2004 10:26:10 -0700

Thanks for the reply. I'm only somewhat familiar with the "static" keyword.
I understand that if I declare a VARIABLE static, there will only be one
instance for a library. So it could be used for keeping an employee count,
for example. But that's static variables, and I'm worried about static
functions or methods...

Are there any "gotcha's" when dealing with static methods? Are variables
used inside the static method automatically static as well? Does that cause
problems if two programs happen to use the same method out of the DLL at the
same time?

Thanks,
/\/\ark

"Ronald Laeremans [MSFT]" <ronaldl@online.microsoft.com> wrote in message
news:%23%23xW9HHaEHA.3708@TK2MSFTNGP10.phx.gbl...
> Use static members of a class instead.
>
> Ronald Laeremans
> Visual C++ team
>
> "Hasani (remove nospam from address)" <hblackwell@n0sp4m.popstick.com>
wrote
> in message news:ut8eo1FaEHA.3420@TK2MSFTNGP12.phx.gbl...
> > They're called global functions in c++
> > they're different than static.
> >
> > http://c.ittoolbox.com/documents/document.asp?i=1596
> >
> > If you were to reference this dll in .net, I doubt a global or static
> > methods will show up though, I did create a project a few months back in
> > managed c++ that used atl and when i referenced it in .net, it listed
> > structures that were not contained in a namespace, but those were
> > structures
> > and not methods.
> >
> > "Mark Prenter" <sorry@toomuchspam.com> wrote in message
> > news:%23rElFNFaEHA.3476@tk2msftngp13.phx.gbl...
> >> Hi all, I'm fairly new to .NET and I haven't done much in C++ before,
> >> nothing complex anyway, but I have a pretty good understanding of
> >> programming in general.
> >>
> >> What I'm trying to do is create a .DLL that contains a lot of the
> > functions
> >> and classes that I normally use. I've followed the examples from
> >> http://www.c-sharpcorner.com/2/pr12.asp which contains a pretty good
> > example
> >> of creating a simple .DLL. Even though the example is in C#, it was
> > pretty
> >> easy to translate into C++ .NET.
> >>
> >> And here's the question : I was able to create a simple DLL which
> > contains
> >> classes, but I have not figured out how to include simple functions.
Is
> > it
> >> possible to have functions in a DLL that aren't associated with any
> >> particular class or object? "Simple" functions, as I call them?
> >>
> >> Thanks,
> >> /\/\ark
> >>
> >>
> >
> >
>
>



Relevant Pages

  • Re: [META] Talking about talking about C.
    ... with the fact that you can declare things of the type size_t after you ... information that size_t is probably an alias for a standard integer ... to reserve the name __SIZE_T as a keyword that's the name ...
    (comp.lang.c)
  • Re: Why not auto?
    ... auto keyword can not be used to ... >>> declare formal parameter. ... >> No storage class specifier except register can be used for function ... The keyword "static" is the factotum of the C Standard, ...
    (comp.lang.c)
  • Re: static data-member undefined external
    ... :>: It's just like a global varaible, you can declare it in as many header files ... could treat explicit static members the same way it does implicit statics, ... explicitly define declared static members ensues from the implementations. ... If I have to declare a static ...
    (comp.lang.cpp)
  • Re: JDK implementation of inner classes doesnt match Java Language Specification
    ... Inner classes may not declare static members, ... inner class seems to be a non-static class DIRECTLY enclosed by ... Because class 'C' is declared inside an interface, and a "member type declaration in an interface is implicitly static and public" [JLS ss. ... I don't understand why use of static members is limited at all. ...
    (comp.lang.java.programmer)
  • Re: Random Number Function
    ... > doing a batch update to the table from MS Access, ... > DECLARE @RandomNumber DOUBLE ... > Incorrect syntax near the keyword 'SET'. ...
    (microsoft.public.sqlserver.programming)