Re: Program crash with regex wrapper after translation

new topic     » goto parent     » topic index » view thread      » older message » newer message

Andy Serpa writes:
> So ANY call in ANY program to regex_find without regex_compile in your 
> own code (or with it, but then you have to call regex_free yourself) 
> will cause the crash.  I should have mentioned I'm using all the latest 
> versions of the interpreter & translator (unregistered) and am on a 
> WinME system.  I tried compiling with both Borland & lccWin, same 
> result.

I duplicated the problem on my system using the
Translator with Borland or Lcc, but with Watcom it
runs fine. It also runs fine with exw (built by Watcom) as you noted.

I believe what's happening is that pcre.dll 
contains C functions that were compiled using the
_cdecl calling convention, rather than the _stdcall
convention that Euphoria expects.

In most cases, when using Watcom (Translator or interpreter),
you can call  _cdecl C routines and it will work. With Borland
and Lcc the call stack gets screwed up and
a crash is likely to occur.

Maybe in a future release (2.4?) I will experiment with
either detecting automatically, or having the user
tell me when a C routine is compiled as _cdecl.

Summary:

_stdcall: 
    all WIN32 API routines
    fixed number of arguments only
    callee resets the stack pointer

_ cdecl: 
    more common these days
    allows for variable number of arguments
    caller must reset the stack pointer          

values are passed/returned the same way,
except for structures and doubles

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu