[fpc-devel] strange error with arm compiler when compiling-running this code
Roozbeh GHolizadeh
roozbehid at yahoo.com
Wed Mar 14 11:27:58 CET 2007
I have a big project in c,and i wanted to somehow use
it in fpc,so i compiled the code with evc(embedded
visual c compiler 4.0 of microsoft)and linked it to my
pascal code.
i dont know why but i just get errors in evc + fpc in
arm.bcc32 + delphi and vs.net + fpc both compiles and
run ok.(also bcc32 + fpc wont work,illegal coff magic
error)
Any ideas?
my c code :
typedef struct
{
char *name;
}
namestruct;
#define NULL ((void *)0)
static namestruct namestructs[8] = {
{"Not Implemented"},
{"Not Implemented"},
{"Not Implemented"},
{"Not Implemented"},
{"Not Implemented"},
{"Not Implemented"},
{"Not Implemented"},
{"Not Implemented"},
};
int
strcasecmp (char *s1, char *s2)
{
if (s2 == NULL)
return 1;
if (s1 ==NULL)
return 1;
//return 0;
if (*s2 == 0) //error is generated here in arm
mode!whenever accessing *s2!and it seems s2 is also
not a null pointer
return 1;
return 0;
while (*s1 /*&& toupper (*s1) == toupper (*s2)*/)
{
s1++;
s2++;
}
return *s1 - *s2;
}
int findname (char *s)
{
int i;
for (i = 8; i; i--)
if (strcasecmp (s, namestructs[i].name) == 0)
return i;
//changing strcasecmp (s, namestructs[i].name) to
strcasecmp (s, NULL) also makes code ok!
return 0;
}
my pascal code :
{$apptype console}
{$link testpchar.o}
function findname (s : PChar) :
cardinal;cdecl;external name 'findname';
var
s:string;
begin
writeln('start');
s:='hi'#0#1;
writeln(findname(pchar(s)));
writeln('end');
end.
regard,
roozbeh
____________________________________________________________________________________
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/
More information about the fpc-devel
mailing list