473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

static module functions

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
Aug 8 '06 #1
2 910
"Lee Crabtree" <lc*******@goisi.comwrote in message
news:uh**************@TK2MSFTNGP04.phx.gbl...
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);
}
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
Aug 8 '06 #2
>>
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.
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.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Aug 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jeff | last post by:
Hello everybody, I have a question concerning function declarations. When exactly do you have to declare functions if you want to use them? I have two functions main() and foo(), respectively...
3
by: Roman Mashak | last post by:
Hello, All! As far as I understand, function declaration with 'static' keyword limits the access to these functions within the file where it declared. So, my question is: where can it be used in...
6
by: Ravi | last post by:
Hi All: Is there any reason for declaring functions as static in a header file if that header file is going to be included in several other files? The compiler throws a warning for every such...
12
by: codefixer | last post by:
Hello: I am trying to understand the use of static in this program. http://nanocrew.net/sw/nscdec.c for "inverse" matrix. What difference would it make if it were not static and just "const...
3
by: Phillip Ian | last post by:
Just a quick architecture question. I'm just looking for discussion, not a flame war, please. In the past, I've tended to use a public module for my data layer functions. Something like: ...
11
by: Mark | last post by:
Is that true you can't have a static method in VB.NET? Public Static Sub Initialize() -- ??? thanks Mark
10
by: stonny | last post by:
I read the following sentence from a c++ website, but can not understand why. can anyone help me with it? " An important detail to keep in mind when debugging or implementing a program using a...
7
by: Szabolcs Nagy | last post by:
this is probably only a stylistic question what do you think to be better in a single .c file program, declaring functions with static qualifier or without it? eg: #include <stdio.c> static...
2
by: Nagrik | last post by:
Dear Group, The book of Bjarne Stroustrup in chapter 5.4.4 says the following "The word static is one of the most overused words in C and C++. For static data members it has both of the...
28
by: Why Tea | last post by:
I seem to remember that in ANSI C, all static functions should have their function prototypes listed at the beginning of the file for better consistency (or something like that). I googled and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.