Re: gec: Is it possible to specify a signature for a external C call?
Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]> Tue, 13 Nov 2007 09:14:39 +0100
| Newsgroups | gmane.comp.lang.eiffel.gobo.general |
|---|---|
| Message-ID | <[email protected]> |
Berend de Boer wrote: > Eric> The fact that it works with SmartEiffel and ISE Eiffel is just > Eric> luck in my opinion. > > It works, because they emit a prototype. That had to be coded, so it's > not luck. The luck is that it's not specified anywhere in the standard and you might have no prototype if you specify a header file that does not contain such prototype. > Eric> Does it work as well when you add assertions to these > Eric> external routines? > > Yes. The created prototypes are just for the called external function. What I meant is that if there are assertions, a wrapper needs to be generated. So my fear was that they would generate a prototype for the wrapper and not for the external function. But perhaps they don't generate such wrapper. > For ISE it generates the prototype in a .c file: > > extern EIF_REAL_64 posix_difftime(EIF_INTEGER_32, EIF_INTEGER_32); > > > If I add a header with: > > external "C use <time.h>" > > No such prototype is created. > > So their behaviour is intentional and it allows everyone to link to > libraries without having to know how to write header files (or having to > distribute them if you distribute your C code). I'll do like ISE, but I still think that it is not right and works because of luck. Or if you prefer, it does not work in some cases because of lack of luck (e.g. when you specify a header file that does not contain a prototype for your routine). -- Eric Bezault mailto:ericb-D6Qt/9opevxWk0Htik3J/[email protected] http://www.gobosoft.com