Trap errors during function call

Notices and updates
Locked
ale870
Posts: 297
Joined: Mon Nov 26, 2007 8:01 pm
Location: Italy

Trap errors during function call

Post by ale870 »

Hello,
I mapped some functions made in PureBasic (using tecnique proposed by Lutz):

Code: Select all

(set 'MyFunction dummy1)
(cpymem (pack {ld} 265) (first (dump MyFunction)) 4)
(cpymem (pack {ld} @MyAddress) (+ (first (dump MyFunction)) 12) 4)
(cpymem (pack {ld} {MyFunction}) (+ (first (dump MyFunction)) 8)  4)
Now the problem is as soon as I call that mapped function from newLisp self, and I make a mistake in parameters datatype (e.g. I use a number instead a string) I get amemory access violation, and everything crash.
Is there any way to "grab" that memory violation error from newLisp self?

Thank you!
--

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Is there any way to "grab" that memory violation error from newLisp self?
Once you have stepped on wrong memory its too late. You have to check your parameters before passing them to low level machine routines.
Last edited by Lutz on Mon Jan 05, 2009 2:55 pm, edited 1 time in total.

ale870
Posts: 297
Joined: Mon Nov 26, 2007 8:01 pm
Location: Italy

Post by ale870 »

ok, I see.
Thank you for your help!
--

Locked