Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9163637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:29:36+00:00 2026-06-17T14:29:36+00:00

EDIT: You can use unsafe code… you just have to manually edit the proj

  • 0

EDIT: You can use unsafe code… you just have to manually edit the proj file.

Why or why does C# on WP8 not support unsafe code when I can use native C++ code on the phone(I did not expect this)? I mean rly come on, I am so disappointed with what Microsoft is trying to force C# into.

Is there any MS plans to support this in the future on WP8? I pass shader constants from C# to C++ and use unsafe code to optimize this process but on WP8 i’m going to be forced into doing this in some slow fashion on a WAY slower device compared to a PCs and it makes this very frustrating.

As an example to pass a vector4 to C++ I would do:

public unsafe void Set(Vector4 value)
{
    com.Set((int)&value, sizeof(Vector4));
}

Then in C++:

void ShaderVariableCom::Set(__int32 data, int size)
{
    void* ptr = (void*)data;
    if (vertexOffset != -1) memcpy(vertexBytes + vertexOffset, ptr, size);
    if (pixelOffset != -1) memcpy(pixelBytes + pixelOffset, ptr, size);
}

Anyone have a good fast way of doing this without unsafe code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:29:37+00:00Added an answer on June 17, 2026 at 2:29 pm

    I found a solution.

    For simple vector types just do:

    Marshal.StructureToPtr(vector, nativePtr, false);
    

    And for arrays do:

    var data = new Vector[10];
    int size = Marshal.SizeOf(data[0]);
    for (int i = 0; i != data.Length; ++i)
    {
        Marshal.StructureToPtr(data[i], nativePtr + (size * i), false);
    }
    

    If anyone has a better answer that would be good to know too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: I can use Actionscript 3.0 and/or Java I have a bit of a
I've read posts about why you can't have a (Edit -- generic) (which use
Ok, i can use jeditable to edit-in-place some content on a page and the
Solution Edit: Turns out you can't use the PHP SDK to return the correct
In the below code onclick edit how can the value of tag test be
I have this file (warning: potentially unsafe file download site) that I need to
I have been finding some articles and post which suggest not to use the
Is there any app that I can use to edit .resx files on a
I have just installed Sql Server Compact Edition . To my surprise, we can't
I have an existing PDF and I can use FdFWriter to input to text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.