473,394 Members | 1,759 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.

extern and override specifiers?

Why can a method have the specifiers extern and override together in its
signature?
A extern method is a function called from a native dll. but how could i
override a function??? The same is for extern and the unsafe-modifier -
aren't extern functions alwys "unsafe" in the sense of
"non-dotnet-function"?

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 15 '05 #1
2 2234

"codymanix" <do*********************@gmx.de> wrote in message
news:uD**************@TK2MSFTNGP10.phx.gbl...
Why can a method have the specifiers extern and override together in its
signature?
A extern method is a function called from a native dll. but how could i
override a function??? The same is for extern and the unsafe-modifier -
aren't extern functions alwys "unsafe" in the sense of
"non-dotnet-function"?
from MSDN:
Use the extern modifier in a method declaration to indicate that the method
is implemented externally. A common use of the extern modifier is with the
DllImport attribute. (See DllImportAttribute Class for more information.)

Now, while it is used in dll import calls, there is no requirement that it
be used as such. I suppose it may be usable in some other circumstances(or
may be at some point in time) in such a way that virutal is possible? It
issues a warning anyway.

unsafe does not mean non-dotnet function, it means it uses a pointer, there
is a difference. An imported function can exist in "safe" code, just not one
that uses pointers directly. --
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk

Nov 15 '05 #2
> > Why can a method have the specifiers extern and override together in its
signature?
A extern method is a function called from a native dll. but how could i
override a function??? The same is for extern and the unsafe-modifier -
aren't extern functions alwys "unsafe" in the sense of
"non-dotnet-function"?
from MSDN:
Use the extern modifier in a method declaration to indicate that the

method is implemented externally. A common use of the extern modifier is with the
DllImport attribute. (See DllImportAttribute Class for more information.)

Now, while it is used in dll import calls, there is no requirement that it
be used as such. I suppose it may be usable in some other circumstances(or
may be at some point in time) in such a way that virutal is possible? It
issues a warning anyway.

unsafe does not mean non-dotnet function, it means it uses a pointer, there is a difference. An imported function can exist in "safe" code, just not one that uses pointers directly.

When you import a function from a native dll then this IS unsafe code.
Correct me if iam wrong but you can't import a method from another
dotnet-dll.

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu
[noncommercial and no fucking ads]
Nov 15 '05 #3

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

Similar topics

9
by: tropostropos | last post by:
On Solaris, using the Sun compiler, I get annoying warnings from the following code. The problem is that I am passing a C++ member function pointer to the C library function qsort. Is there a...
19
by: ccwork | last post by:
Hi all, I am reading "C: A Reference Manual" 4th ed and I get lost for the "extern". It says that global object without specifying the storage-class specifier will have "extern" as the default...
5
by: Christian Christmann | last post by:
Hi, I've tree questions on the storage class specifier "extern": 1) Code example: int main( void ) { int b = -2; // my line 3 if ( a ) {
7
by: Christian Christmann | last post by:
Hi, I've a a question on the specifier extern. Code example: void func( void ) { extern int e; //...
9
by: joshc | last post by:
Hi, I have an array defined in one file with an intializer as follows: int arr = {0, 1, 2, 3}; I have a declaration of the array in another file as follows: extern int arr;
5
by: Steven T. Hatton | last post by:
This note appears in the discussion of name hiding and uniqueness: §3.3 #4 This note is item #6 in the discussion of "Point of declaration" §3.3.1 #6 What exactly do these statements mean?...
3
by: coder | last post by:
While reading the page on "Reading C Declarations" <http://www.ericgiguere.com/articles/reading-c-declarations.html> (recommended by Mr. Heathfield at...
7
by: Travis | last post by:
I'm relatively new to externs and function pointers but have inherited the task of modifying some existing code. I have something like this. extern void myExternFunc (MenuItem *item, void *...
2
by: Shraddha | last post by:
Can we declare extern variable as static? What will be the scope of the variable then? What if we change the value of the variable in some other function? Also can someone tell me that if we can...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.