BBC BASIC for Windows
« WM_COPYDATA problem »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:22pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: WM_COPYDATA problem  (Read 295 times)
Nick
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 33
xx Re: WM_COPYDATA problem
« Reply #4 on: Sep 25th, 2013, 1:52pm »

[quote author=Richard Russell
All I can say is that receiving a 'No such variable' message is consistent with heap corruption, so that's something to investigate. [/quote]

OK - I will double check...

[quote author=Richard Russell
Incidentally - although it can't be the source of the problem - your comment 'This has to be fast' seems rather incongruous alongside the actual code, which appears to have been written to be about as slow as possible!

Richard. [/quote]

Thanks for that. Like many experienced programmers with precious little time to go up the learning curve, I usually opt for things that are least likely to be additional reasons for something to break. But I am sure it can be re-written to be faster - your suggestions would be most welcome.

Nick
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: WM_COPYDATA problem
« Reply #5 on: Sep 27th, 2013, 11:23am »

on Sep 25th, 2013, 1:52pm, Nick wrote:
OK - I will double check...

Did you find the fault?

Quote:
But I am sure it can be re-written to be faster - your suggestions would be most welcome.

If the amount of data is substantial (say a kilobyte or more) I would recommend using SYS "RtlMoveMemory" to transfer it:

http://msdn.microsoft.com/en-us/library/windows/hardware/ff562030.aspx

If it's relatively small, a FOR...NEXT loop using static integer variables won't be too bad:

Code:
      S% = source%
      D% = destination%
      FOR I% = 0 TO bytecount%-1 : D%?I%=S%?I% : NEXT 

Of course if you know that the byte count is an exact multiple of 4 this will be faster:

Code:
      S% = source%
      D% = destination%
      FOR I% = 0 TO bytecount%-4 STEP 4 : D%!I%=S%!I% : NEXT 

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls