Hi, I am using Inline C and have a problem using standard C library, especially fopen and fscanf. The DLL compiled fine. When I run a perl script to call the DLL, the Perl crashed.
See 'perldoc perlclib' for preferred alternatives to some of the functions you are using. Not sure if that will solve things for you.
Below is my C routine:
int test_readfile(char *filename, SV* output) { char str[80]; float f; FILE * pFile;
pFile = fopen(filename, "w+"); fprintf (pFile, "%f %s", 3.1416, "PI"); rewind (pFile); fscanf (pFile, "%f", &f); fscanf (pFile, "%s", str); fclose (pFile); printf("I have read: %f and %s \n",f,str); sv_setpvn(output, "This is a test from C routine!", 30); return 0; }
I am using Windows XP SP2, Visual Studio .NET 2003. The same code works fine in Linux. Appreciate very much to hear any suggestion...
There could also be a problem if you're using that compiler with a perl built with Visual Studio 6.0. If your perl was built with Visual Studio 6.0 (as is the case with ActiveState perl) then you should probably build your own perl using the .NET compiler and use that perl instead.
Cheers, Rob