Well I have found the error:
> private fun getcwd: &char * size -> &char = "getcwd($1,$2)";
> fun getcwd():string = {
> var b: array[char,1024];
> var p = getcwd(C_hack::cast[&char] (&b),size 1024);
> return if C_hack::isNULL p then "" else string p endif;
> }
saying:
> SYSTEM FAILURE
> Binding error, cannot find in table: getcwd_mf_1322 index 1322
>
> Anyhow, the REAL error is not that we can't find this entry in the table,
> since clearly entry 1322 is there, how else would we know its name??
and indeed I'm right. There is a real error in the code above.
C_hack::isNULL is defined by:
fun isNULL: address -> bool = "(NULL==$1)";
fun isNULL[t]: ptr[t] -> bool = "(NULL==$1)";
fun isNULL[t]: cptr[t] -> bool = "(NULL==$1)";
fun isNULL[t]: gcptr[t] -> bool = "(NULL==$1)";
and we have:
publish "Abstract type for C pointer"
pod type ptr[t]= "?1 *";
publish "Abstract type for C pointer to const"
pod type cptr[t]="?1 const *";
but the argument is type &char, which is a Felix pointer.
So the real error is simple: overload resolution failed.
This code:
private fun getcwd: &char * size -> &char = "getcwd($1,$2)";
fun getcwd():string = {
var b: array[char,1024];
var p : &char = getcwd(C_hack::cast[&char] (&b),size 1024);
var q = C_hack::isNULL p;
return "";
}
has the same error, but gives:
Client Error binding expression ((C_hack)::isNULL p)
CLIENT ERROR
[lookup_qn_with_sig] (Simple module) Unable to resolve overload of
(C_hack)::isNULL of (&char)
candidates are: {
fun std::C_hack::isNULL[t<3089>]: gcptr[<T3089>] -> bool = "(NULL==$1)"rq<2941>;
defined at build/release-optimized/lib/std/c_hack.flx: line 93, cols 1 to 49
with view vs=t ts=<T3090>
fun std::C_hack::isNULL[t<3085>]: cptr[<T3085>] -> bool = "(NULL==$1)"rq<2941>;
defined at build/release-optimized/lib/std/c_hack.flx: line 92, cols 1 to 48
with view vs=t ts=<T3086>
fun std::C_hack::isNULL[t<3081>]: ptr[<T3081>] -> bool = "(NULL==$1)"rq<2941>;
defined at build/release-optimized/lib/std/c_hack.flx: line 91, cols 1 to 47
with view vs=t ts=<T3082>
fun std::C_hack::isNULL: address -> bool = "(NULL==$1)"rq<2941>;
defined at build/release-optimized/lib/std/c_hack.flx: line 90, cols 1 to 45
with view vs= ts=
}
In ./tmp.flx: line 7, cols 13 to 28
6: var p : &char = getcwd(C_hack::cast[&char] (&b),size 1024);
7: var q = C_hack::isNULL p;
****************
but this:
return if C_hack::isNULL p then "" else string p endif;
is throwing Not_found .. on the SAME expression. The only real
difference is that in the second case an initialisation is generated.
Hmm ..
--
john skaller
[email protected]
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language