getting information from the NativeBMAP is quite easy :
- get the pointer from the BMAP object
- use Marshal.PtrToStructure to get the content

you should be able to do this with all objects, like NativeENTITY etc...

Code:
BMAP someBmap = BMAP.bmap_create("someBmap.bmp");

AcknexWrapper.Native.NativeBMAP nativeBmapStruct =
    (AcknexWrapper.Native.NativeBMAP)System.Runtime.InteropServices.Marshal.PtrToStructure(someBmap.getIntPtr(), typeof(AcknexWrapper.Native.NativeBMAP));

IntPtr final_bits = nativeBmapStruct.finalbits;



if you want to change such a variable (that is normally not used and thus not implemented in the wrapper.. things are not that easy.. for example to change the finalbits member of the NativeBMAP struct you would have to do the following :

Code:
IntPtr newFinalBitsValue = (IntPtr)234234;
IntPtr positionOfFinalBitsInStruct =
  System.Runtime.InteropServices.Marshal.OffsetOf(typeof(AcknexWrapper.Native.NativeBMAP), "finalbits");

// destination to write to = the pointer to the struct in unmanaged memory + the offset of the finalbits variable in the struct
IntPtr positionToWriteTo =
  (IntPtr)(
    (int)someBmap.getIntPtr() +
    (int)positionOfFinalBitsInStruct);
            
// write the new value to the position in the memory where the finalbit part of the
// struct is stored
System.Runtime.InteropServices.Marshal.WriteIntPtr(positionToWriteTo, newFinalBitsValue);



P.S.:
this of course only works for IntPtr in this example, there are several other cases where you have to do conversions etc...

Last edited by Stromausfall; 02/20/12 10:55.

get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread