How to access MFC classes in Python using SWIG ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Harish

    How to access MFC classes in Python using SWIG ?

    I am using Python2.3 version with SWIG-1.3.19 to access C++ interface
    provided by a DLL.
    Some of its function returns MFC class objects like CString , CMap. I
    tried to generate wrapper for these classes using SWIG by including
    respective header files in .i file.
    But it doesn't work. Swig reports hundreds parsing errors in MFC's
    file.
    Could you give me any directions..

    Thank you in anticipation
    Harish
  • John J. Lee

    #2
    Re: How to access MFC classes in Python using SWIG ?

    harry_chillboy@ rediffmail.com (Harish) writes:
    [color=blue]
    > I am using Python2.3 version with SWIG-1.3.19 to access C++ interface
    > provided by a DLL.
    > Some of its function returns MFC class objects like CString , CMap. I
    > tried to generate wrapper for these classes using SWIG by including
    > respective header files in .i file.
    > But it doesn't work. Swig reports hundreds parsing errors in MFC's
    > file.[/color]

    I'd guess that looking into how win32all does it, and copying that and
    integrating your stuff with it would be the easiest way to go. I
    don't think it uses SWIG.


    John

    Comment

    • Brian Kelley

      #3
      Re: How to access MFC classes in Python using SWIG ?

      John J. Lee wrote:[color=blue]
      > harry_chillboy@ rediffmail.com (Harish) writes:
      >
      >[color=green]
      >>I am using Python2.3 version with SWIG-1.3.19 to access C++ interface
      >>provided by a DLL.
      >>Some of its function returns MFC class objects like CString , CMap. I
      >>tried to generate wrapper for these classes using SWIG by including
      >>respective header files in .i file.
      >>But it doesn't work. Swig reports hundreds parsing errors in MFC's
      >>file.[/color][/color]

      the ctypes package may do what you want


      Brian

      Comment

      • Harish

        #4
        Re: How to access MFC classes in Python using SWIG ?

        Brian Kelley <bkelley@wi.mit .edu> wrote in message news:<3fe07ab5$ 0$579$b45e6eb0@ senator-bedfellow.mit.e du>...[color=blue]
        > John J. Lee wrote:[color=green]
        > > harry_chillboy@ rediffmail.com (Harish) writes:
        > >
        > >[color=darkred]
        > >>I am using Python2.3 version with SWIG-1.3.19 to access C++ interface
        > >>provided by a DLL.
        > >>Some of its function returns MFC class objects like CString , CMap. I
        > >>tried to generate wrapper for these classes using SWIG by including
        > >>respective header files in .i file.
        > >>But it doesn't work. Swig reports hundreds parsing errors in MFC's
        > >>file.[/color][/color]
        >
        > the ctypes package may do what you want
        > http://starship.python.net/crew/thel.../tutorial.html
        >
        > Brian[/color]

        Thanx Brian for your reply,
        ctypes is really very helpful in my case to access most of the
        functions. But I am stuck with some functions which return objects of
        MFC::CString or CMap<>. ctype talks only about c type function and
        simple data types. SWIG provides readymade wrappers for common STL
        classes but not MFC :(

        Comment

        Working...