in reply to Re: Why can't I call a C subroutine using Inline-C module?
in thread Why can't I call a C subroutine using Inline-C module?
This works fine: ...
Interesting. It doesn't work here (on Linux, though), independently of whether I declare/pass arguments to main or not:
#!/usr/bin/perl use Inline 'C'; main(); __END__ __C__ int main() { printf("foo\n"); return 0; }
$ ./826910.pl Segmentation fault
My guess would be that this is because main is special (the entry point of an executable). If you rename the XS routine to something else like main2, however, it prints "foo" as expected.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Why can't I call a C subroutine using Inline-C module?
by syphilis (Archbishop) on Mar 05, 2010 at 08:51 UTC | |
by BrowserUk (Patriarch) on Mar 05, 2010 at 09:19 UTC |