473,396 Members | 1,755 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,396 software developers and data experts.

pymem.h In function '__declspec'

I have installed Python-2.3.3 in the SUSE Linux 9.1 system and am
trying to rebuild an application rpm that was implemented in Python, I
am getting the following error,

/usr/Python-2.3.3/Include/pymem.h In function '__declspec'
/usr/Python-2.3.3/Include/pymem.h:51: error: parse error before
'__declspec'
/usr/Python-2.3.3/Include/pymem.h:50: error: declaration for parameter
'PyMem_Malloc' but no such parameter
:

I thought '__declspec' is used in the Windows DDLs, but I am compiling
the extension module in the Linux environment. Do I need to run
something else first to setup the correct env?

Jul 18 '05 #1
1 1542
What does this command print?
gcc -c -I/usr/Python-2.3.3/Include -x c -o /dev/null \
/usr/Python-2.3.3/Include/pymem.h
If it prints an error like the one you included in this message, then
the set of header files in /usr/Python-2.3.3/Include is damaged,
incomplete, or wrong for your compiler environment. If the files in
/usr/Python-2.3.3 are from SUSE, then contact your vendor.

If it doesn't give an error, but the build of your "application RPM"
does, then investigate the compiler defines that are present in the
application that aren't on the above commandline. For instance, I was
able to get errors like yours by using inappropriate compiler
options:
$ gcc -DPy_ENABLE_SHARED -DHAVE_DECLSPEC_DLL -c -x c -o /dev/null \
/usr/include/python2.3/Python.h
In file included from /usr/include/python2.3/Python.h:67:
/usr/include/python2.3/pymem.h: In function `__declspec':
/usr/include/python2.3/pymem.h:51: error: syntax error before "__declspec"
....

You're right that __declspec has something to do with Windows DLLs.
Normally, Python uses the macro 'PyAPI_FUNC' to declare all functions in
its header files. For certain compilers (msvc, cygwin, mingw) it's
appropriate to use the __declspec extension to make the Python shared
library work properly. For other compilers, PyAPI_FUNC doesn't do
anything special. It's through the presence of absence of defines like
Py_ENABLE_SHARED and HAVE_DECLSPEC_DLL that Python decides how to define
PyAPI_FUNC, and this little detail is usually below the radar.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFCLOpdJd01MZaTXX0RAuZzAJ0dlby5QaASiGxw1l/M5BQ7rfWaLwCeKPtD
0E2Od1sszeThT+Ifwjg/83I=
=t7sT
-----END PGP SIGNATURE-----

Jul 18 '05 #2

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

Similar topics

1
by: Bryan Parkoff | last post by:
I created DLL that it includes Bryan() function, but Bryan2() function is defined outside DLL so function pointer is created. I tried to tell DLL that function pointer should be declared, but not...
1
by: Domer | last post by:
In my program, I load dynamically a DLL and I'm able to get a function pointer of type "int (__cdecl *)(void)" of any function in the DLL. If a DLL has a static class function, which calls the...
3
by: Halvdan Friis | last post by:
Hi, I've run into a problem with exporting and importing a function from a DLL. Hopefully somebody here can tell me how this should be done properly. My DLL function is as follows: void...
3
by: Tony Liu | last post by:
Dear All: I create a very simple DLL by using EVC to test the problem. (The platform I am working for those program is WinCE.NET) ******************************************************* The...
3
by: Adriano Coser | last post by:
Hi. I'm declaring a property on a base class that is represented by a pure virtual function. Something like this: public: __declspec( property( get=GetWidth ) ) int Width; virtual int...
10
by: Gustavo L. Fabro | last post by:
Greetings! I've been porting an application for Builder to VS .NET 2003 and searching for possible bottlenecks (the application is currently running slow). I found out one scenario that takes a...
5
by: Felix I. Wyss | last post by:
Good Afternoon, I recently noticed that some very simple methods of a template declared and used in a DLL library get inlined when used by the DLL itself, but not by other DLLs and EXEs. After...
2
by: Marek | last post by:
Hi I'm trying to call a native C++ dll using the following code (both C# and C++ code segments included). When I make the call to the method (AddTwoDoubles) that has no return value all is fine. ...
1
by: Markus Demetz | last post by:
Hi, I'm quite new to C++. I'm developing under Microsoft Visual Studio, andI've written some classes and want them to be exported to a .dll. I use a macro DLL_EXPORT and everything goes well....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.