❔ system.accessviolationexception: attempted to read or write protected memory
I created an c++ dll to call this -> https://pastes.dev/MIdnPDHsBs from C#
But i get this exception
system.accessviolationexception: "attempted to read or write protected memory. this is often an indication that other memory is corrupt."What i am doing wrong and how can i solve this Should i try to code this in C# ?
21 Replies
I would generally try to avoid having to do interop with native if you can
in any case, that's just C#'s way of saying segfault
I dont know how i can recode this because of the pointers
the parameters seem to just be arrays
Maybe using unsafe context and the pointers in c#
everything else seems like it could just be an index into those arrays
no pointers needed
pInput + 1 means this the pointer is shifted to the next element ?
essentially, yes
Thanks, i will give it a try
What is the difference between
pInput + 1And
pInput[1]
not much, most of the time
When i use pInput + 1, is the pointer constant shifted ?
is pinput a constant?
and yes, it's incremented by the element size
no
then what do you mean 'pointer constant'?
When i call pInput + 1
Will it the same value when i call after taht pInput
I cant understand the question
Will the pointer stay in the new position or goes back after the call
'the pointer'?
'x+1' doesnt change x
0x00000 <- pointer is here
pointer + 1
0x00001 <- pointer is here
print(pointer)
Will it print 0x00000 or 0x00001
Its only pseudo code
0x00001 <- pointer is hereno, 'pointer' didnt change x=0; x+1; print(x); did you change x?
No
Then this means i got only the value from adress 0x00000 with the offset 1 (0x00001)
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.