Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / August 2006

Tip: Looking for answers? Try searching our database.

static module functions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lee Crabtree - 08 Aug 2006 21:26 GMT
I'm not sure what the term is, but is it possible in C++/CLI to create a
function not in a class that would then be visible to other .NET
languages?  Something like:

namespace Blah
{
  public ref class Thing
  {
  };

  static void OhNoesImNotInAClass(int omfgwtfbbq);
}

Lee Crabtree
Carl Daniel [VC++ MVP] - 08 Aug 2006 21:38 GMT
> I'm not sure what the term is, but is it possible in C++/CLI to create a
> function not in a class that would then be visible to other .NET
[quoted text clipped - 8 lines]
>   static void OhNoesImNotInAClass(int omfgwtfbbq);
> }

No, it's not.   While (I believe!) the CLR does support free functions at a
very low level, they wouldn't be visible to any other language (and I'm not
sure if C++/CLI would compile the code anyway).  Stick to functions that are
class members.

-cd
Bruno van Dooren [MVP VC++] - 08 Aug 2006 21:52 GMT
>>   static void OhNoesImNotInAClass(int omfgwtfbbq);
>> }
[quoted text clipped - 3 lines]
> not sure if C++/CLI would compile the code anyway).  Stick to functions
> that are class members.

If I recall correctly, someone had this problem a couple of months ago,
where C++ compiled and used a free variable without a problem. C# couldn't
use it because it has no concept of things existing outside of classes.
He tried to export constants.
The solution was to create a class named CONST with const data members.

Signature

Kind regards,
   Bruno van Dooren
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.