473,386 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,386 software developers and data experts.

From Unmanaged, unsafe to Managed, safe...


Hi Newsgroup,

General C# questions. If I have a class(es), of API functions just as they
are. Would that be considered Unmanaged or unsafe (not meant as the c#
keyword) code? If I implement error checking, and disposing appropriate
resources for those functions would my program then be considered managed
(or safe)?

In general I'd like to ask (not just with API functions) can you construct
an assembley that would confirm to the definition (I don't really know it)
of Managed code with respect to the .NET Framework, from using unmanaged
resources? So that if you passed that assemebley to someone else, you could
say, it's managed and hence safe. If it can, what guide lines should be
followed?

SpotNet
Nov 17 '05 #1
2 1507
Code executing under the control of the runtime is called managed code.
Conversely, code that runs outside the runtime is called unmanaged code. COM
components, ActiveX interfaces, and Win32 API functions are examples of
unmanaged code. Runtime here is called Common Language Runtime ( CLR )

--
Vadym Stetsyak aka Vadmyst
"SpotNet" <Sp*****@msnews.grp> wrote in message
news:O9**************@TK2MSFTNGP14.phx.gbl...

Hi Newsgroup,

General C# questions. If I have a class(es), of API functions just as they are. Would that be considered Unmanaged or unsafe (not meant as the c#
keyword) code? If I implement error checking, and disposing appropriate
resources for those functions would my program then be considered managed
(or safe)?

In general I'd like to ask (not just with API functions) can you construct
an assembley that would confirm to the definition (I don't really know it)
of Managed code with respect to the .NET Framework, from using unmanaged
resources? So that if you passed that assemebley to someone else, you could say, it's managed and hence safe. If it can, what guide lines should be
followed?

SpotNet

Nov 17 '05 #2

Thank you very much Vadym.

SpotNet

"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:uS****************@tk2msftngp13.phx.gbl...
Code executing under the control of the runtime is called managed code.
Conversely, code that runs outside the runtime is called unmanaged code.
COM
components, ActiveX interfaces, and Win32 API functions are examples of
unmanaged code. Runtime here is called Common Language Runtime ( CLR )

--
Vadym Stetsyak aka Vadmyst
"SpotNet" <Sp*****@msnews.grp> wrote in message
news:O9**************@TK2MSFTNGP14.phx.gbl...

Hi Newsgroup,

General C# questions. If I have a class(es), of API functions just as

they
are. Would that be considered Unmanaged or unsafe (not meant as the c#
keyword) code? If I implement error checking, and disposing appropriate
resources for those functions would my program then be considered managed
(or safe)?

In general I'd like to ask (not just with API functions) can you
construct
an assembley that would confirm to the definition (I don't really know
it)
of Managed code with respect to the .NET Framework, from using unmanaged
resources? So that if you passed that assemebley to someone else, you

could
say, it's managed and hence safe. If it can, what guide lines should be
followed?

SpotNet


Nov 17 '05 #3

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

Similar topics

16
by: Ekim | last post by:
hello, I'm allocating a byte-Array in C# with byte byteArray = new byte; Now I want to pass this byte-Array to a managed C++-function by reference, so that I'm able to change the content of the...
47
by: Bonj | last post by:
I downloaded the gzlib library from zlib in order to do compression. (http://www.gzip.org/zlib) The prototype of the compression function seems to be int compress (Bytef *dest, uLongf *destLen,...
4
by: apm | last post by:
Can calling conventions of functions be changed in unmanaged C# in a similar way that they can be changed using C++?
2
by: The unProfessional | last post by:
Any know how to convert a managed array to an unmanaged array (ptr)? // Managed float f = new float ; // Unmanaged unsafe { float *pArray = f; // No good
1
by: sklett | last post by:
STILL trying to wrap an unmanaged C++ class that is itself a wrapper to some COM stuff, not sure, it is littered with LPDISPATCH and InvokeHelper, etc. Problem is, when something goes wrong, I'm...
5
by: Andrew | last post by:
I want to use a managed c++ class from an unmanaged class. Here is my code: // *** Unmanaged Code // .h file class UnmanagedClass { public: // Other stuff here
6
by: Aston Martin | last post by:
Hi All, ********************** My Situation ********************** I am working on project that involves passing a structure to unmanaged code from .Net world (well using C#). Perhaps an example...
3
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I'm trying to specify the requirement from unmanaged DLL component that will be used by a managed application written in C#. The unmanaged DLL is implementing some kind of algorithm for defect...
0
by: tomwolfstein | last post by:
Hi. I am trying to write a wrapper for the standard VC1 decoder, and I need to resolve a "TypeLoadException" The decoder comes an an executable which I've turned into a .dll. This decoder has about...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.