Re: [ctypes-users] Absolute paths to DLLs in xml2py
Brought to you by:
theller
From: Mark H. <ma...@mi...> - 2006-09-19 21:54:52
|
Thomas Heller wrote: > Thomas Heller schrieb: > >> Alan Green schrieb: >> >>> Hi, >>> >>> The .py file generated by xml2py embeds the absolute paths to windows >>> DLLs. This works fine until I move to a PC that has Windows installed >>> in, say, C:\WINNT instead of C:\WINDOWS. Is there a simple way to >>> cause the code generated by xml2py to search the Windows path for the >>> DLL that it needs? >>> >> I'll change that in SVN, because it seems wrong for windows (at least). >> >> Generally, to customize the code generator for your needs you should >> subclass it. >> >> Of course you can also hack the generated code instead. >> > > I think that the locating and loading of shared libs/dlls is highly > operating system specific. I have not much experience with anything > other than windows. My current feeling is that if you want to > wrap a shared library in a truly cross-platform way you have to > write the code that loads the libraries manually anyway. > > If anyone has experience with this, I'd like to hear it... > > Thomas > > The codegenerator (subclassed) puts out the correct lib finding code for me on linux, right at the top of the module. > _libraries = {} > _libraries['libmylib.so.0'] = CDLL('libmylib.so.0') and it appears that running the code build on a windows box would automatically generate the correct Win DLL lookups (untested). Ive also found that subclassing and / or manipulating the xml2py arguments is the way to go vice manipulating the code after the generation. It takes some study of the codegenerator and the typedesc module but its worth it. Mark |