<p dir="ltr">> Mat* cv_imread(String* filename, int flags) {<br>
>     return new Mat(cv::imread(*filename, flags));<br>
> }</p>
<p dir="ltr">How is the String type defined in C? Also, why are you wrapping the C++ API rather than the C API? </p>
<p dir="ltr">-- <br>
Luís Oliveira<br>
<a href="http://kerno.org/~luis">http://kerno.org/~luis</a></p>
<p dir="ltr">(sent from my phone)<br>
On Mar 19, 2014 3:44 AM, "Joeish W" <<a href="mailto:joeish80829@yahoo.com">joeish80829@yahoo.com</a>> wrote:<br>
><br>
> I'm trying to recreate a const char* filename parameter for code I have that needs it...The function I'm wrapping is the OpenCV C++ function "imread" it is below in the documentation.  It is used to read an image(jpg etc) from a file and return a pointer to it<br>

><br>
> <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=imread#imread">http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=imread#imread</a><br>

><br>
> first I need to wrap in C as below calling  the const char* filename parameter as a String*<br>
> the below cv_imread does compile on ubuntu trusty using g++. And the function works as intended using g++.<br>
></p>
<p dir="ltr">><br>
> I wrap in Lisp like this:<br>
><br>
> (defcfun ("cv_imread" %imread) (:pointer mat) <br>
>   (filename (:pointer string*)) <br>
>   (flags :int))<br>
><br>
> When I usually create a (:pointer string*) parameter I do it like this <br>
><br>
> (window-name (foreign-alloc :string :initial-element "IMREAD Example"))<br>
>                <br>
>  and it works to supply strings that aren't filenames but when I try to use a filename both absolute and relative paths it fails...it also fails using double forward slashes in the pathname.<br>
><br>
><br>
> Any advice is appreciated and btw Emacs /SBCL is my Lisp IDE<br>
</p>