C# pointers in unmanaged environment - compiler options

gajus

Member
Joined
Nov 13, 2006
Messages
7
Location
Brussels
Programming Experience
1-3
Unsafe code may only appear if compiling with /unsafe. If source code contains the unsafe keyword, then the /unsafe compiler option must also be used.

Problem:
Because my code is complex and uses many references, I can't figure out how to use the Visual Studio Command Prompt to compile the code.

Question:
Do I really need to use the Command Prompt or is there another way to compile my code successfully?
 
Welcome to the VB.Net Forums, this web site is for VB.Net related inquiries only.
 
I a'm a vb.net programmer. Unfortionatly if you want to want tu use pointers in an unmanaged environment you have to use C#!!!
There is no other way. My project is 99% in VB.net and 1% in C#, because mr Gates left us no other choise.

Therefore this is a VB.net related problem.

By the way this is the second time in my VB.net carier that I'm struggling with this issue, and I'm sure I'm not the only one.

So if anyone could help me, it would be very much appreciated. I'm sure you can understand that this VB.net related, dear admininistrator!
 
If you read MSDN, when compiling unsafe code, you have 2 options: you can check the “allow unsafe code” checkbox on the projects build tab or you can use the Command Prompt (which is boring and complex). Fore some reason the first option did not work out. Every time I reopened the project, the checkbox was grayed instead of checked. Therefor the compiler kept bugging me. So I started changing about every setting I could find. What MSDN didn’t mention was that you need to check the checkbox “allow unsafe code debugging” on the debug tab as well. So now the dll compiles with success.

:)
 
I dont quite understand the problem.. Every time I've needed to use unmanaged code, I havent had a problem in VB.NET or C#, compiling within the IDE.. Perhaps giving more information would help (try to avoid posting a lot of C# code though). JohnH might also then show you a way to achieve what you want in VB.NET ?
 
I also don't understand the problem. Create a solution and add a VB.NET application project. Add a C# class library project with the appropriate settings for unsafe code. In the application add a reference to the library. Build the solution. That's it. The C# compiler will be used to build the C# project into an assembly first and then the VB compiler will be used to build the VB project into an assembly. You just distribute both and your app will work.
 
Back
Top