www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - SWIG 4 D2 How To : namespace, friend, operator()

reply BLS <windevguy hotmail.de> writes:
Hi, this is my first attempt to use SWIG for D2, So in case that my 
questions are stupid simple.. Sorry.

questions are included in swig file wincore.i

/* wincore.i */
%module(directors="1") wincore
%{
#include "wincore.h"
%}

%include "std_string.i"
%include <windows.i>

/* turn on director wrapping for CWnd */
%feature("director") CWnd;

namespace Win32xx   // 	HOW TO deal with namspaces ?
{
class CWnd
   {
     	// HOW TO handle friend ?
	friend class CMDIChild; //defined in frame.h !!!!
	friend class CWinApp;   //define in wincore.h
     // ............
   }
}


Last question is about  : operator()

f.i.	bool operator()(HWND const a, const HWND b) const

Klickverbot suggests to use the SWIG's %rename. But how that would look 
like in practice ?

Beside, I guess this is what opImplicitCast should solve. maybe alias 
this could help somehow .. dunno.

Thanks in advance..
Bjoern
Dec 12 2010
parent Jimmy Cao <jcao219 gmail.com> writes:
--0023547c9037a1718204973faea0
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Dec 12, 2010 at 2:13 PM, BLS <windevguy hotmail.de> wrote:

 Last question is about  : operator()

 f.i.    bool operator()(HWND const a, const HWND b) const

 Klickverbot suggests to use the SWIG's %rename. But how that would look
 like in practice ?

 Beside, I guess this is what opImplicitCast should solve. maybe alias this
 could help somehow .. dunno.

 Thanks in advance..
 Bjoern

%rename(_call) *::operator(); Currently Klickverbot is working on support for operator overloading wrappers. --0023547c9037a1718204973faea0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Sun, Dec 12, 2010 at 2:13 PM, BLS <span dir=3D"ltr">&lt;<a href=3D"mailt= o:windevguy hotmail.de">windevguy hotmail.de</a>&gt;</span> wrote:<br><div = class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin: 0p= t 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1= ex;"> <br> Last question is about =A0: operator()<br> <br> f.i. =A0 =A0bool operator()(HWND const a, const HWND b) const<br> <br> Klickverbot suggests to use the SWIG&#39;s %rename. But how that would look= like in practice ?<br> <br> Beside, I guess this is what opImplicitCast should solve. maybe alias this = could help somehow .. dunno.<br> <br> Thanks in advance..<br> Bjoern<br> <br></blockquote><div><br>I think you can do this:<br><div style=3D"margin-= left: 40px;">%rename(_call)=A0 *::operator();<br><br></div><br>Currently Kl= ickverbot is working on support for operator overloading wrappers.<br></div=

</div> --0023547c9037a1718204973faea0--
Dec 12 2010