extern and override specifiers?

  • Thread starter Thread starter codymanix
  • Start date Start date
C

codymanix

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"?
 
codymanix said:
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
 
Why can a method have the specifiers extern and override together in its
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 ****ing ads]
 
Back
Top