Re: Program crash with regex wrapper after translation
- Posted by kbochert at ix.netcom.com Jan 04, 2002
- 487 views
-------Phoenix-Boundary-07081998- Hi Robert Craig, you wrote on 1/4/02 7:47:11 PM: >>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 I compiled the pcre.dll from the publicly available C sources using the LCC compiler. The sources do not have 'cdecl" in them. I have attached the makefile I used which also doesn't mention cdecl. (and is nearly as unintelligible as the makefile distributed with PCRE). Perhaps the dll should be compiled with Watcom? That would at least speed it up considerably. -------Phoenix-Boundary-07081998- Content-type: application/octet-stream; Name=makefile