Most character or data pointers in C cannot be used just as such in perl. They will have to be converted to a SCALAR value
The nice thing about Inline::C is that it should take care of this, i.e. the necessary .xs (and .c) code doing the conversions is created behind the scenes - at least for simple types such as char*.
For example, the following function returning a char* is mapped to a normal scalar on the Perl side:
#!/usr/bin/perl use Inline C => Config => BUILD_NOISY => 1, CLEAN_AFTER_BUILD => 0; use Inline C => <<'END_OF_C_CODE'; char* GetImage() { char *data = "test-test-test"; return(data); } END_OF_C_CODE my $data = GetImage(); print "$data\n"; # "test-test-test"
(btw, the CLEAN_AFTER_BUILD => 0 option I've specified above is very useful when you want to look at the auto-generated XS/C wrapper code for debugging purposes)
So, if the data as returned by the OP's GetImage() function is in fact char*, things should just work fine in this regard. In other words, I suspect the problem lies elsewhere...
In reply to Re^2: Open CV problem
by Anonyrnous Monk
in thread Open CV problem
by russellp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |