Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / matrix1util_4

Author
Message
basjak
9
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 21st Sep 2011 18:51
I am experiencing constant crashes on my code. I tried different ways but all have crashed.

Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 21st Sep 2011 20:36 Edited at: 21st Sep 2011 20:37
You can't just link an array to some memory you've allocated without setting up all the internal data, and even then whether it works or not depends how IanM's alloc command works... "link array" is for linking one array to the pointer you got from another, primarily for allowing you to pass arrays into functions.

[b]
basjak
9
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 22nd Sep 2011 01:33
it sounds to me from the matrix explanation that it is an unsafe array linking where we are linking an array to a memory address and any changes to that adress area will effect the array itself.

however, do you have a solution?.
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd Sep 2011 11:51
A solution to what? What exactly are you trying to acheive?

[b]
basjak
9
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 22nd Sep 2011 13:53
am trying to achieve a solution or example of a solution.
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd Sep 2011 13:55
Quote: "am trying to achieve a solution or example of a solution."


Quote: "A solution to what? What exactly are you trying to acheive?"


[b]
basjak
9
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 22nd Sep 2011 16:09
Quote: ""am trying to achieve a solution or example of a solution.""


Quote: "A solution to what? What exactly are you trying to acheive?"


Quote: "I am experiencing constant crashes on my code. I tried different ways but all have crashed."


crashes are caused by:
1- using ansafe memory access (peek and poke).
2- and/or linking array to pointer.

do you have another solution?
I am interested with the solution because I can make conrol between two programs written in two different coding languages.
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd Sep 2011 17:44
The crashes are because you're trying to do this the wrong way. I'm asking what you are trying to do so I can help you do it the right way.

[b]
basjak
9
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 23rd Sep 2011 00:11
thanks diggsey but I solved the problem in different way. however, you were right I wasn't using those commands for the right purpose that is made for it but still don't understand why unsafe memory access to arrayptr is causing a crash.

anyway, I will give you a hint of what am doing:
I am dsigning a 2D graphic software. in many cases to manipulate a photo, I need a main array, copyarray, changable(image) array. if am about to change a point on the image array, it is faster to poke information staight to memory, rather than calling the screen ptr or bitmap functions.

actually, the software that is poking information is made using c++. this way the user can still use other functions of the software while c++ manipulate data in the background.
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Sep 2011 01:07
Quote: "but still don't understand why unsafe memory access to arrayptr is causing a crash."

Because you didn't create anything that resembled an array in any way - arrays are nothing like what you've attempted in your initial code.

I'll see if I can find the code I originally used to probe the DBPro array format - it was back in 2003 though, so don't hold your breath.

basjak
9
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 23rd Sep 2011 03:16 Edited at: 31st Jan 2012 01:26
Quote: "DBPro array format "


thanks a lot Ian, got the answer. this is why I appreciate this forum a lot.

I found out that DBpro array format use the first 55 bytes to describe the comming array then followed by data.

now, voilaa:


it is still nice to know what info are hidden in the first 55 bytes.

thanks

Login to post a reply

Server time is: 2019-12-06 22:51:13
Your offset time is: 2019-12-06 22:51:13