in reply to Re^3: Need Help with perlxstut
in thread Need Help with perlxstut

All I have is a hilbert.c file and an hilbert.h file Provided to me, I didn't write it. Off third party information I was told the .c file implements the functions defined in the .h file. Together they are about 2700 or so lines of code. The error specifically says "Can't locate auto/main/hilbert_i2c.al" That is a file I'm assuming is generated by the Inline module, but I don't know. The examples I have found don't come any where close to the length or complexity of the two c files I have. I have a book on its way called Extending and Embedding PERL, but until that gets here I need to know what you mean by: "To use it you need the headers and the library" Does that mean both c files should appear between in the section for code of the Inline modlue? If so that is not very apparent, because most of the examples have a few lines of code in which .h files are #included. by the way, I know the two c files work, because I made a simple C++ executable using them and they spit out hilbert indexes and return co-ordinates just fine
#include <stdio.h> #include <iostream> #include "hilbert.h" using namespace std; int main() { unsigned long Coord[3]; hilbert_i2c(3,10,190355,Coord); cout << Coord[2] << ',' << Coord[1] << ',' << Coord[0] << endl; Coord[2] = 35.5; Coord[1] = 40; Coord[0] = 36.8; cout << hilbert_c2i(3,10,Coord) << endl; return 0; }

Replies are listed 'Best First'.
Re^5: Need Help with perlxstut
by tachyon (Chancellor) on Sep 28, 2004 at 23:23 UTC

    You don't seem to understand that a long is an INTEGER type, so can't hold a float.

    use Inline C; print type_def(); #non_existant_function(); __END__ __C__ void type_def () { long foo = 38.5; if ( foo == 38 ) printf("Foo is truncated to integer %d\n", foo ); }

    Uncomment the non_existant_function and you will generate the .al error - it can't autoload the non existant function.

    cheers

    tachyon