wasm-demo/demo/ermis-f/python_m/cur/0098

85 lines
1.9 KiB
Plaintext

From: llwo at dbtech.net.nospam (Karl & Mel)
Date: Mon, 19 Apr 1999 20:39:46 -0500
Subject: calldll windll instantiation
Message-ID: <371bdcbf.0@news.dbtech.net>
Content-Length: 1735
X-UID: 98
Need some help.
I think?(scarry moment)? that I need to create more that one instance of a
dll.
1. Can this be done?
2. Is my sample even close?
"""gm_class quick wrapper of dll functions"""
import windll
import time
class test:
def __init__(self):
self.gm=windll.module('GM4S32')
def load_bde(self, SysDir='c:\\program files\\goldmine',
GoldDir='c:\\program files\\goldmine\\gmbase',
CommonDir='c:\\program files\\goldmine\\demo',
User='PERACLES',
Password=''):
start=time.time()
(SysDir, GoldDir, CommonDir,
User, Password)=map(windll.cstring,(SysDir, GoldDir, CommonDir,
User, Password))
return (self.gm.GMW_LoadBDE(SysDir, GoldDir, CommonDir, User,
Password), "Startup Time: " + str(time.time()-start))
def unload_bde(self):
return self.gm.GMW_UnloadBDE()
...other defs...
>>> import gm_class
>>> a=gm_class.test()
>>> b=gm_class.test()
>>> a
<gm_class.test instance at 856fd0>
>>> b
<gm_class.test instance at 85b140>
>>> a.gm
<win32 module 'GM4S32' (0 functions)>
>>> b.gm
<win32 module 'GM4S32' (0 functions)>
>>> a.load_bde() # This works
(1, 'Startup Time: 0.490000009537')
>>> a.gm
<win32 module 'GM4S32' (1 functions)>
>>> b.gm
<win32 module 'GM4S32' (1 functions)>
>>> b.load_bde() # This fails but should work ;-(
(0, 'Startup Time: 0.0')
>>> a.gm
<win32 module 'GM4S32' (1 functions)>
>>> b.gm
<win32 module 'GM4S32' (1 functions)>
>>> a.gm==b.gm # Don't know if this is correct
1
>>> a==b
0
>>>
>>> gm_class.windll.dump_module_info()
--------------------
WINDLL Function Call Stats:
--- <win32 module 'GM4S32' (1 functions)> ---
2 GMW_LoadBDE
>>>