0

I have the following function in C++ managed (ref) class:

public static void Transform(Bitmap^ img);

I want to call it from C# managed code. What I do is this:

Bitmap image = new Bitmap(100, 100);
MyClass.Transform(image);

Is this correct, or do I need to use fixed statement? If so, then how?

Thank you.

niaher
  • 9,205
  • 7
  • 65
  • 85
  • voted for close due to duplicate: http://stackoverflow.com/questions/661016/how-can-i-pass-a-net-bitmap-to-a-native-dll – Davy Landman Aug 10 '09 at 07:53

1 Answers1

1

You need to lock the bitmap's backing memory as shown here.

Eric J.
  • 143,945
  • 62
  • 324
  • 540