> On Wed, Nov 6, 2013 at 2:56 AM, Benoît Minisini < > gam...@users.sourceforge.net> wrote: > > > Now your code: > > > > ---------------------------------------------------------------------- > 8*< > > ----> OP must points at a 16 bytes allocation. So you failed! The > > library will erase the memory past the allocation, making everything > > crash sooner or later.
OK! Now I understand. > > rtn = UUID_ToStr(OP, SP) > > > > ----> That function returns nothing. I don't know why you think Gambas > > will make it return something. Moreover, if you read the doc, it tells > > you that SP must point at a 37 bytes allocation. So you failed again, > > and the library will erase the memory randomly a second time. Ditto. (Probably didn't look at it closely enough to see the void in the declaration.) > > You really must know C and how a CPU works to deal with extern > > functions. Alas, Gambas can't help there! Or, at least, it does as much > > as he can. Ah there lies the problem! When I learnt programming back in 1972 we had to carve our cpu's out of a lump of granite with a cold chisel, K&R hadn't even written troff so I never did get the hang of this newfangled malloc and pointer and c stuff! Let alone c++ :-) On Wed, 2013-11-06 at 03:03 +0200, Jussi Lahtinen wrote: > Correct code: 8*< Works fine! Thanks Benoît and Jussi, I was fairly sure I had it wrong, I just couldn't see why. Unfortunately since my colleague Keith Lawson passed away I have had to cope with this type of "low level" issue myself without an expert on tap. At least give me 2 points of credit for working out that the output parameters of the library calls were actually pointers to something. regards Bruce p.s. Just saw Benoît's wiki update notice. Did that page exist before? I spent an hour this morning looking for something like that. ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user