[Patches] Extension building on Win32 using Gnu C

Rene Liebscher R.Liebscher@gmx.de
Fri, 16 Jun 2000 18:01:15 +0200


> > The Gnu-C compilers need these imports, there are two ways to do so
> >
> > struct name { ... } __declspec(dllimport);
> > or
> > struct __declspec(dllimport) name { ... };
> >
> > Read also
> > http://gcc.gnu.org/onlinedocs/gcc_4.html#SEC95  (paragraphs 3 and 4)
> > __declspec is another name for __attribute
> > They don't mention dllimport and types in the same context, I don't know
> > why.
> 
> Maybe because it doesn't apply?
> 
> I have never seen *linkage* information applied to a typedef. That just
> doesn't make sense.
It isn't the typedef, it is about the struct (but it looks like the
typedef
because all structs are defined in typedefs)

If if doesn't apply, why crashs C++ if I don't have in there? (I tried
it several times, and checked different positions for this dllimport.
I'm sure it belongs to this struct.)

> > (However, MS Visual C++ uses the same import statements for imports of
> > classes from dll's. egcs 1.1.x uses __declspec() in MS compatible way.)
> 
> Importing classes is different than importing typedefs. A class usually has
> some associated data, which needs to have linkage information associated
> with it.
At least on C++ classes and struct are the same (except struct data are
public
by default.)

> > If you don't have these imports in C-mode you get warnings and in C++
> > mode the compiler chrashs.
> 
> Can you post the warnings that you're receiving? I gotta believe there is
> something else going on.
Currently I don't have access to my Windows machine, so you have to wait 
some days for a complete list of warnings. 

But I remember some things. (All in C mode)

	Py_INCREF(Py_None);
	return Py_None;
=> ( pointer lacks cast ?, I don't remember which line it was.)

---Python's object.h-----------------------
#define Py_INCREF(op) ((op)->ob_refcnt++)
extern DL_IMPORT(PyObject) _Py_NoneStruct; /* Don't use this directly */
#define Py_None (&_Py_NoneStruct)
---------------------------- 
You access here
> some associated data, which needs to have linkage information associated
> with it.
?????????? (Your own words, could it be you know what's wrong and don't
know
that you know it.)

Also if you use type checks.
=> ( incompatible pointer type ? )
-----object.h--------------------
extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of type objects
*/
#define PyType_Check(op) ((op)->ob_type == &PyType_Type)
---------------------------------

Maybe I mixed up the warning messages, but I think you can see the
point.


kind regards

Rene Liebscher