SPUG: Inline doesn't like my code
Scott Blachowicz
scott at sabmail.rresearch.com
Fri Dec 1 18:44:06 CST 2000
On Fri, Dec 01, 2000 at 02:26:54PM -0800, starfire at zipcon.net wrote:
> I'm a first-time user of Inline.pm. The following code generates a
> segmentation fault. If I step through it with the Perl debugger, the error
> message is "Signal SEGV: No such file or directory".
>
> Any suggestions?
>
> use Inline C => <<'END_OF_C_CODE';
>
> #include <time.h>
>
> void get_localtime(int utc) {
>
> Inline_Stack_Vars;
> int *utc, seconds;
Your "utc" local var is hiding your "utc" function argument...which I
imagine isn't what you want?
> struct tm *ltime;
> SV* return_value;
>
> seconds = Inline_Stack_Item(0);
> utc = &seconds;
> ltime = localtime(utc);
Hmmm...shouldn't the C part of it go something like this:
void get_localtime(int utc) {
int seconds = utc;
struct tm *ltime = localtime(&seconds);
}
But I've not used Inline yet, so I'm not sure what those
Inline_Stack_Vars & Inline_Stack_Item guys do, but I'd bet they're not
being used quite right.
--
Scott Blachowicz
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list
mailing list