Hello everyone, I'm trying to call 'C' routine from perl script. I have static library (libFile.a) where I can get object code of this routine and I have linked it with my perl script. This perl script get compile but after running it I'm getting segmentation fault. See code below for reference: =================== C Routine ================== #include <stdio.h> #include <string.h> char * MyMethod(char *data) { strcpy(data,"My text from C Code "); return data; } steps to get libFile.a: cc -c libFile.o libFile.c ar rcs libFile.a libFile.o =========================== PerlScript ============== package Caller; use Inline C => Config => ENABLE => AUTOWRAP, LIBS => '-L/lib_location -lFile', INC => '-I/lib_location' ; use Inline C => <<'END'; char * MyMethod(char *data); AV* AVstr; SV* SVstr1; void DisplayData() { AVstr=newAV(); // Call to function defined in library AVstr = MyMethod(AVstr); printf("\n SVstr1 data: %s\n",AVstr); } END 1; use strict; # call to Function Caller::DisplayData(); 1; Compile: perl -c Script_name run : perl -w Script_name Do you have any guess why am I getting Segmentation fault? Is this the right way to pass parameters and particularly memory allocation and deallocation? Thanks in advance.
~~~~~~~~~~~~~~~~~~~~ Thanks and Best regards, ~ Rajnikant Software Engg. Persistent Sys. Ltd. Ph. +91 98222 04088 DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.