Re: C Compiler problem with eulibcURL

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

C Bouzy wrote:
> Thomas K. wrote:
> > I just came across a problem with eulibcURL:
> > I wrote a program using eulibcURL, then I compiled it with the 
> > Euphoria/Borland, but when I execute it, it will not work. 
> 
> It is not you, it is the EU To C Borland translator. A few times I have 
> translated a app that works fine in EU but crashes when translated to C
> using Boarland. If you compile your app using Watcom it will work.
> But it would be nice to find out why EULibCurl crashes when translated
> to C using Borland. 

As I keep explaining, this type of situation is almost invariably 
due to an error in the application program where the programmer has
failed to specify the CDECL calling convention. By luck, the program usually
works with the exw interpreter, or with the Translator and Watcom.
(If it works, it will always work.)

If you change two lines in eulibcURL, in the file wrapper.ew,
adding a "+" at the start of each name to indicate the CDECL
convention, then it stops crashing with Borland and starts working fine. 
(I haven't retested any others, but easy_download.exw started 
working when I made this change.)

------------------------------------------------
-- link_func - taken from win32lib - thanks David
------------------------------------------------
global function link_func(atom dll, sequence name, sequence args, atom result)
         integer handle

handle = define_c_func(dll, "+" & name, args, result) -- add "+" to
         name
         if handle = -1 then
        wait_abort("Couldn't link to C function " & name)
         end if
         return handle

end function

------------------------------------------------
-- link_proc - taken from win32lib - thanks David
------------------------------------------------
global function link_proc(atom dll, sequence name, sequence args)
         integer handle

         handle = define_c_proc(dll, "+" & name, args) -- add "+" to name
         if handle = -1 then
        wait_abort("Couldn't link to C procedure " & name)
         end if
         return handle

end function


Since Ray isn't active here anymore, I will upload this change
to Recent User Contributions after testing it some more.

To be fair, this CDECL feature was not available
when Ray created eulibcURL.

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