473,395 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
Jul 18 '05 #1
3 3604
ha************@rediffmail.com (Harish) writes:
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.


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
Jul 18 '05 #2
John J. Lee wrote:
ha************@rediffmail.com (Harish) writes:

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.


the ctypes package may do what you want
http://starship.python.net/crew/thel.../tutorial.html

Brian

Jul 18 '05 #3
Brian Kelley <bk*****@wi.mit.edu> wrote in message news:<3f*********************@senator-bedfellow.mit.edu>...
John J. Lee wrote:
ha************@rediffmail.com (Harish) writes:

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.


the ctypes package may do what you want
http://starship.python.net/crew/thel.../tutorial.html

Brian


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 :(
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jon Moldover | last post by:
Hi, I'm using Python in my win32 app by linking to the python23.dll. I'm trying to expose some c++ code in my app to Python so I can make application calls from Python scripts (according to the...
7
by: Bo Peng | last post by:
Dear Python group: I am planning on an application that involves several complicated C++ classes. Basically, there will be one or two big data objects and some "action" objects that can act on...
0
by: Helmut Zeisel | last post by:
I want to build a static extension of Python using SWIG and VC++ 6.0 as described in http://www.swig.org/Doc1.3/Python.html#n8 for gcc. My file is testerl.i: ========================= %module...
3
by: Lars Moastuen | last post by:
Im trying to extend a class written in C++ in Python and use this extended class in a C++ call... I made an example to clarify: -- Foo.h -- #ifndef FOO_H #define FOO_H #include <iostream>...
1
by: Arthur Chereau | last post by:
Hi, I'm trying to setup viewcvs to work with subversion 1.2.0 on Linux with Python 2.4.1. The last viewcvs (from CVS) needs subversion python bindings. I installed swig and built subversion from...
2
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
6
by: matey | last post by:
I am have version 2.3.4. I want to write a python script to access a secure HTTPS. I tried the following: import urllib urllib.urlopen("https://somesecuresite.com") s = f.read() f.close()
5
by: emmanuel.rivoire | last post by:
Hello, I spent almost a week to be able to embed Python within my C++ game engine. I wrote a mini-tutorial of what I was able to do so far here :...
0
by: Basha J P M | last post by:
I am beginner in python. I am working through the tutorial examples from http://www.swig.org/ and have run into some problems. I took the following command instructions from the tutorial on...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.