Re: match arguments in "later" part of a C function argument list
William S Fulton <[email protected]> Wed, 22 May 2024 07:38:28 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CANGqftD8sgXez5LdLO4sVKg7v__DAFSO7WpscWYt6fwrYyY61Q@mail.gmail.com> |
--===============2745891605811184500== Content-Type: multipart/alternative; boundary="000000000000e47f4d061905302e" --000000000000e47f4d061905302e Content-Type: text/plain; charset="UTF-8" On Mon, 20 May 2024 at 07:43, Andy Tai <[email protected]> wrote: > Hi, can typemaps be used to match "later" parts of the arguments of a > C function? > For example, if I have a C function > > void func(int a1, const char *str, size_t size) ; > > where the second and the third arguments are meant to pass in a C string. > > I find that if I try to apply the typical typemap > > %typemap(in) (const char *, size_t) { > Change above line to: void func(int a1, const char *str, size_t size) ; then you'll see the typemap contents in the generated code. You could also use -debug-tmused to see if your typemap matches, see http://swig.org/Doc4.2/Typemaps.html. Once you see your code in the wrapper function, then maybe it will need further work, I'm not familar enough with Guile to know if it will actually work. William --000000000000e47f4d061905302e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Mon, 20 May 2024 at 07:43, Andy Ta= i <<a href=3D"mailto:[email protected]">[email protected]</a>> wrote:<br></di= v><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;borde= r-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, can typemaps be use= d to match "later" parts of the arguments of a<br> C function?<br> For example, if I have a C function<br> <br> void func(int a1, const char *str, size_t size) ;<br> <br> where the second and the third arguments are meant to pass in a C string.<b= r> <br> I find that if I try to apply the typical typemap<br> <br> %typemap(in) (const char *, size_t) {<br></blockquote><div>Change above lin= e to:</div><div><br></div><div>void func(int a1, const char *str, size_t si= ze) ;</div><div><br></div><div>then you'll see the typemap contents in = the generated code. You could also use -debug-tmused to see if your typemap= matches, see <a href=3D"http://swig.org/Doc4.2/Typemaps.html">http://swig.= org/Doc4.2/Typemaps.html</a>. Once you see your code in the wrapper functio= n, then maybe it will need further work, I'm not familar enough with Gu= ile to know if it will actually work.</div><div><br></div><div>William<br><= /div></div></div> --000000000000e47f4d061905302e-- --===============2745891605811184500== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============2745891605811184500== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Swig-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/swig-user --===============2745891605811184500==--