1
Answer

Unsafe code and portability.

Ask a question

Hi.

 

I am programming in C#. I would like to use unsafe code for improve the performance of a scientific library.

 

However, I am not sure about the implications of the unsafe code on the portability of the library.

 

The Visual Studio documentation says:

 

“In the common language runtime (CLR), unsafe code is referred to as unverifiable code. Unsafe code in C# is not necessarily dangerous; it is just code whose safety cannot be verified by the CLR. The CLR will therefore only execute unsafe code if it is in a fully trusted assembly”.

 

What is a fully trusted assembly?

 

I know that it is not possible to run unsafe code directly from the Internet. However this is not a problem for my library because is not designed for that.  Is there another limitation?

 

Can all use my library or what do the users need to do?

 

I have the same library in Fortran. However I would like to use unsafe code in C# because I eliminate the overhead associated whit the unmanaged calls?

 

Which library do you think is better to distribute, the Fortran o the C# library with unsafe code?

 

 

Best Regards.


Answers (1)