473,219 Members | 1,649 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,219 software developers and data experts.

/clr:safe

ajk
Hi

I am doing a C++/CLI dll that is supposed to be fully managed code. I
was wondering what exactly is the criteria for the DLL to be 100%
fully managed and usuable from C#? Do I need to compile using /
clr:safe or is /clr enough?

The reason I need to know this is that I would like to use pin_ptr<>
for some type conversions i.e. bytes to say decimal but /clr:safe
doesn't allow me to do much with that pointer.

tia
ajk
Jun 27 '08 #1
1 1528
ajk wrote:
I am doing a C++/CLI dll that is supposed to be fully managed code. I
was wondering what exactly is the criteria for the DLL to be 100%
fully managed and usuable from C#?
These are two different things. In fact, to be useful from C#, a DLL does
not have to be managed at all.
Do I need to compile using / clr:safe or is /clr enough?
/clr is enough if you just want to be able to call the DLL without interop
wrapping (as unmanaged code would require). Your public interface should be
restricted to managed types, manipulating only managed types. What you do
internally is then of no concern to the outside world.
The reason I need to know this is that I would like to use pin_ptr<>
for some type conversions i.e. bytes to say decimal but /clr:safe
doesn't allow me to do much with that pointer.
Using /clr:safe restricts you to constructs that allow the DLL to be an
assembly containing only managed code. There are speed and safety benefits
to this, but it is by no means a requirement to be able to use the code from
other managed assemblies.

In fact, there's really not much point to writing pure managed code in
C++/CLI unless you happen to really like C++: the strength of C++/CLI is
exactly that it can mix managed and unmanaged constructs and thus glue the
two worlds together. If you want pure managed code, you might as well use C#.

--
J.
http://symbolsprose.blogspot.com
Jun 27 '08 #2

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

Similar topics

7
by: Gustavo L. Fabro | last post by:
Greetings! Some classes that once compiled without problems on VS 2003 have now problems on VS 2005 Beta 1. I'm talking about a __nogc class that is exported with __declspec(dllexport). The...
12
by: Herby | last post by:
Hi, I am currently reviewing what is required to convert a current MFC, COM server application into a .NET application. The objective is to compile ultimately to clr/safe. So we are seeking a...
8
by: Gary Nastrasio | last post by:
If I compile with /clr:safe, which is exactly meant by saying I can't use "Native Types" in my code? Is a native type something such as float, short, or int? Thanks, Gary
0
by: vishal.nagota | last post by:
I'm making a project on vc++ express I want to plot graphs, so using MSChart evrything goes fine, till i come to point where I've to include afxdisp.h by defualt i'm using Project properties...
5
by: Bart | last post by:
Hi, What is the benefit of using the Pure option over the Mixed one. Is there a better performance? We have a lot of stuff in c++ with mfc support en we want to use in our .net apps. With...
6
by: R.Kaiser | last post by:
I know that I can call Win32 API functions in a Windows forms application by specifying each function header individually like in using namespace System; using namespace...
10
by: SQACPP | last post by:
Hi, I try to figure out how to use Callback procedure in a C++ form project The following code *work* perfectly on a console project #include "Windows.h" BOOL CALLBACK...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

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.