Am Freitag, 21. Juli 2006 07:53 schrieb chromatic:
> Should this code work?  I think so.

This can't work for several reasons:

1) the NCI call signatures don't match the C functions' args:

        .store_nci_func( 'const_string', 'ppt' )

should be: 'SIt'  (return STRING*, interp & C-cstring args)

        .store_nci_func( 'string_to_cstring', 'tpp' )

should be: "tIS"  (return C-string, interp & STRING args)

(You could use 'pIt' and 'pIp' signatures too, then the STRING* result of the 
'const_string' would be wrapped into a ManagedStruct PMC).

2) print does *not* take c-strings, but STRINGs, therefore:

        hello = string_to_cstring( interpreter, greet_string )
        print hello

is likely to just segfault.

> -- c

leo

Reply via email to