Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments in function signature cause "Undefined subroutine" but no compilation error #101

Open
hadjiprocopis opened this issue Dec 27, 2021 · 0 comments

Comments

@hadjiprocopis
Copy link

Comments in the function signature "confuse" Inline::C although there are no C-related compilation errors. In the below example, myfunc3() succeeds while the other two fail to be called with the error: "Undefined subroutine &main::myfunc called"

use Inline C => 'DATA';

# these 2 fail:
print myfunc1(42), "\n";
print myfunc2(42), "\n";

# this succeeds:
print myfunc3(42), "\n";

__END__
__C__
use Inline C => 'DATA';

# these 2 fail:
# but if you comment them out, it succeeds, there
# are no C-related compilation problems
#print myfunc1(42), "\n";
#print myfunc2(42), "\n";

# this succeeds:
print myfunc3(42), "\n";

__END__
__C__
#include <stdio.h>

int myfunc3(
	/*int a*/
	int b
);
/* comments in the function signature cause
     Undefined subroutine &main::myfunc called
*/
int myfunc1(
	/* int a */
	int b
){ fprintf(stdout, "hello %d\n", b); return 0; }

int myfunc2(
	// int a
	int b
){ fprintf(stdout, "hello %d\n", b); return 0; }

/* this is OK, even if its declaration contains comments */
int myfunc3(
  /* ahahahah */
  int b
);
int myfunc3(
	int b
){ fprintf(stdout, "hello %d\n", b); return 0; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant