Forget about that.

Pyinstaller COM support is for now completely buggy.

To overcome your problem, here is how I process:
1) Download pyinstaller source code and extract it
2) Install Visual C++ express 2008
3) Inside MSVC console, go to bootloader source directory

DllRegisterServer is not exported in bootloaders because, with msvc 
(notice: not with gcc), you have to explicitely telling him that 
dllmain.def has to be taken into account during link step, if you want the 
relevant 4 functions to be exported. As I have not found any clue to tell 
waf how to include this dependency, I do something else. 

4) Modify C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\ObjBase.h 
and C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\OleCtl.h to 
modify DllCanUnloadNow, DllGetClassObject, DllRegisterServer, 
DllUnregisterServer and precede their prototype with __declspec(dllexport).
5) It's not enough. In ..\PyInstaller-2.1\bootloader\windows, you have to 
modify dllmain.c and add :
#pragma comment( linker, "/export:DllCanUnloadNow=_DllCanUnloadNow@0")
#pragma comment( linker, "/export:DllGetClassObject=_DllGetClassObject@12")
#pragma comment( linker, "/export:DllRegisterServer=_DllRegisterServer@0" )
#pragma comment( linker, 
"/export:DllUnregisterServer=_DllUnregisterServer@0")
the goal is to force linker to export the corresponding functions without 
the _ and @n decorations.

6) Recompile and put the 4 win32 generated DLLs in 
..Python27\Lib\site-packages\PyInstaller\bootloader\Windows-32bit

7) Unfortunately, it is not enough because startUp function inside 
dllmain.c is buggy. There is a totally meaningless memset inside it. You 
have to replace it with code borrowed from 
..\PyInstaller-2.1\bootloader\common\main.c. More explicitely:

ARCHIVE_STATUS *archive_status = NULL;
archive_status = (ARCHIVE_STATUS *) calloc(1,sizeof(ARCHIVE_STATUS));

8) Unfortunately, this is not enough. When Iregister mycom object, there 
was still errors:

LOADER: Manipulating Python's sys.path
  File "<string>", line 1
    sys.path.append(r"..\test_com\")

                                                       ^
SyntaxError: EOL while scanning string literal

and

Installed ZlibsLOADER: Running scripts
Traceback (most recent call last):
  File "<string>", line 15, in <module>
AttributeError: 'module' object has no attribute '_MEIPASS'
LOADER: RC: -1 from pyi_rth_Tkinter
Loading PythoncomPythoncom failed to load

Hope this help, and will give hints to others to continue to debug COM 
functionnality of pyinstaller.

Hope Pyinstaller will read this post and won't drop COM support in future 
release, because it is so useful.

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to