Upgrading Python Breaks Extensions; Fix proposal

Alex Martelli aleax at aleax.it
Fri Aug 31 12:35:27 CEST 2001


"Gordon McMillan" <gmcm at hypernet.com> wrote in message
news:Xns910DE5F425785gmcmhypernetcom at 199.171.54.194...
    ...
> The difference that is germain to this thread is that while
> you can export symbols from an exe, you don't get a lib.

When you link an EXE that exports symbols, you do normally
get a LIB file from it as well.  Try this simple test:

== file thexe.c:
#include <stdio.h>

__declspec(dllexport)
int main() {
    printf("Hello, EXE speaking\n");
    return 0;
}
== end of thexe.c

C:\TEMP\te>cl thexe.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

thexe.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:thexe.exe
thexe.obj
   Creating library thexe.lib and object thexe.exp

The last line is a giveaway, of course, but anyway:

C:\TEMP\te>dir
 Volume in drive C is AMACN33ABZ
 Volume Serial Number is 0443-BAE0

 Directory of C:\TEMP\te

08/31/01  12:32p        <DIR>          .
08/31/01  12:32p        <DIR>          ..
08/31/01  12:32p                   117 thexe.c
08/31/01  12:32p                28,672 thexe.exe
08/31/01  12:32p                   524 thexe.exp
08/31/01  12:32p                 1,882 thexe.lib
08/31/01  12:32p                   473 thexe.obj
               7 File(s)         31,668 bytes
                            405,891,072 bytes free


> So to get to the symbols in the exe, you'd have to do it
> yourself, which means a typedef and a GetProcAddress for each
> symbol. Which makes the TCL stubs idea look very good.

I like the stubs idea!  Even though you DO get the .lib
from linking the .exe, I'd much rather not *rely* on it...

> There's a reason extension modules only need to export
> one symbol, you know.

Yep, but it's not that you don't get a lib when linking an
exe [which exports some symbols]:-).


Alex






More information about the Python-list mailing list