[Pyrex] Creating a DLL with Pyrex.
Blake Winton
bwinton at latte.ca
Mon Nov 8 22:37:56 CET 2004
> Phillip J. Eby wrote:
> > Also, to build the DLL, you can probably use the distutils; it's just
> > that the distutils generate a .pyd file. Rename it to .dll and you
> > should be set, as .pyd's are actually .dll's internally.
> Hah! So I can! And there's an option to specify which functions I want
> to export, too. It took a little futzing, and it's kind of a shame that
> I can't create the list of exports automatically, but it's good enough
> for my purposes.
Okay, so I've gotten to the point where I want to call some of the
methods in the library, and now I have found out that the library is
written in C++. My research indicates that I need to wrap the library
with another C-based wrapper, but I can't find any suggestions on how to
do that. I've copied and translated the headers I'm using into C, and
I've created an "fooImpl.cpp" file which will implement the C functions
by calling the C++ functions, but it seems like a lot of work, and I'ld
like some encouragment that I'm going down the right path before I spend
hours and hours on this.
Anyways, a sample C++ function definition would be:
long CSyncRegisterConduit (CONDHANDLE &) ;
And I've translated it into C as:
long CSyncRegisterConduit (CONDHANDLE *) ;
And then my implementation would look like:
long CSyncRegisterConduit( CONDHANDLE* p1 ) {
return SyncRegisterConduit( *p1 );
}
Does that look close to being correct?
Thanks,
Blake.
More information about the Pyrex
mailing list