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:
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
I think you can do this: %rename(_call) *::operator(); Currently Klickverbot is working on support for operator overloading wrappers.
Dec 12 2010