First thanks to Manu and Eric Bezault for your help. I should have seen the
obvious code error but sometimes the obvious is something you just can't
seem to see. I altered the code to this:
quot (a_item: POINTER): INTEGER
external
"C inline use <stdlib.h>"
alias
"[
{
struct
div_t* itm = $a_item;
return
(int)(itm->quot);
}
]"
end
set_quot (a_item: POINTER; v: INTEGER)
external
"C inline use <stdlib.h>"
alias
"[
{
struct
div_t* itm = $a_item;
(int)(itm->quot) = $v;
}
]"
end
I now get the error:
c:\users\saunders\documents\eiffel 6.2 user
files\projects\mandolin3\eifgens\mandolin3_project\w_code\c4\di2005.c(43) :
error C2037: left of 'quot' specifies undefined struct/union 'div_t'
c:\users\saunders\documents\eiffel 6.2 user
files\projects\mandolin3\eifgens\mandolin3_project\w_code\c4\di2005.c(54) :
error C2037: left of 'quot' specifies undefined struct/union 'div_t'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\Bin\amd64\cl.EXE"' : return code '0x2'
Stop.
div_t is declared in stdlib.h so I don't see why this should appear to be
undefined to the C compiler. I would also like to ask Eric why the need for
the brackets around (itm->quot)? Here is the declaration of div_t from my
version of stdlib.h:
typedef struct _div_t {
int quot;
int rem;
} div_t;
Regards
Chris Saunders
From:
eiffel_software@...
[mailto:
eiffel_software@...] On Behalf Of Eric Bezault
Sent: Saturday, July 05, 2008 3:17 AM
To:
eiffel_software@...
Subject: Re: [eiffel_software] Another question on C inline usage
Chris Saunders wrote:
> quot (a_item: POINTER): INTEGER
> external
> "C inline use <stdlib.h>"
> alias
> "[
> {
>
> struct div_t* itm = $a_item;
> return (int)a_item->quot;
> }
> ]"
> end
>
> Can anyone assist?
I guess it should be:
return (int)(itm->quot);
using `itm' and not `a_item'.
--
Eric Bezault
mailto:
ericb@... <mailto:ericb%40gobosoft.com>
http://www.gobosoft.com
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/eiffel_software/<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/eiffel_software/join (Yahoo! ID required)
<*> To change settings via email:
mailto:
eiffel_software-digest@...
mailto:
eiffel_software-fullfeatured@...
<*> To unsubscribe from this group, send an email to:
eiffel_software-unsubscribe@...
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/