Hey Gabriel,<div>Thanks a lot for replying. I was able to run this python script from console/command prompt using cygwin python. I'm not sure whats the difference between these two versions of python. But it seems to be working. Searching theough the web i found that having cygwin1.dll could be causing this issue. So I'm trying to build my DLL using MinGW which will not create an dependecy DLL's. But I'm stuck up with few more issue in porting few functions to MinGW.</div>
<div><br></div><div>I'm using Python2.7 and Cygwin Python 2.6.5</div><div><br></div><div><i>Reply to your comments:</i><br><br><i>* why do you initialize cygwin1.dll in Python? If it's a dependency of my.dll, it might be better to load and initialize it there.</i><br>
<font color="#000066">Yes, cygwin1.dll is actually a dependency to my.dll. hence I'm loading it and initializing it</font><br><i>* for this function prototype: void cygwin_dll_init(void);</i><br><i>you should declare it using:</i></div>
<div><font color="#000066">I'm doing this as you said. But didn't mention it in my mail</font></div><div><font color="#000066"><div><br></div><div>hCyg = cdll.LoadLibrary(CygWinDLL_Name)</div><div>hCyg = CDLL(CygWinDLL_Name)</div>
<div>Prototype_Cyg = CFUNCTYPE(c_void_p)</div><div>Init = Prototype_Cyg (("cygwin_dll_init", hCyg))</div><div>Init.restype = c_void_p</div><div>Init()</div><div><br></div></font>Thanks,<br>Sathish<br>
<br><br><div class="gmail_quote">On Fri, Sep 2, 2011 at 7:56 AM, Gabriel Genellina <span dir="ltr"><<a href="mailto:gagsl-py2@yahoo.com.ar">gagsl-py2@yahoo.com.ar</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
En Mon, 29 Aug 2011 07:40:06 -0300, Sathish S <<a href="mailto:sathish@solitontech.com" target="_blank">sathish@solitontech.com</a>> escribió:<div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
We created a DLL using cygwin and have written a class based python module<br>
for the same. We have created a sample script for the class based python<br>
module, that creates an object of the class and calls various methods in the<br>
class. This Test script works fine while I run it from IDLE. However when I<br>
run it from command prompt it either hangs or just returns without executing<br>
the functions. When it returns I do not get a error trace.<br>
<br>
When I tried to findout where exactly the issue is happening. the issue<br>
occurs when I try to call the *cygwin_dll_init* method of the cygwin1.dll .<br>
This cygwin1.dll is actualy a dependency to the DLL we have built. So we<br>
have to load this DLL and call this *cygwin_dll_init* method before loading<br>
my DLL.<br>
<br>
<br>
cyg = cdll.LoadLibrary("cygwin1.dll"<u></u>)<br>
cyg.cygwin_dll_init() #hangs or returns here<br>
mydll=cdll.LoadLibrary("my.<u></u>dll")<br>
mydll.func1()<br>
I'm trying to understand what exactly is the difference, when we call it<br>
IDLE and when we call it from command prompt using the python command. I<br>
will have to get the script working from command prompt as well.<br>
</blockquote>
<br></div></div>
A few comments:<br>
<br>
* why do you initialize cygwin1.dll in Python? If it's a dependency of my.dll, it might be better to load and initialize it there.<br>
<br>
* for this function prototype: void cygwin_dll_init(void);<br>
you should declare it using:<div class="im"><br>
<br>
cyg = cdll.LoadLibrary("cygwin1.dll"<u></u>)<br></div>
cyg.restype = None<div class="im"><br>
cyg.cygwin_dll_init() #hangs or returns here<br></div>
...<br>
<br>
Anyway, I don't see why a console application would fail but not inside IDLE.<br>
<br>
-- <br>
Gabriel Genellina<br><font color="#888888">
<br>
-- <br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/python-list</a><br>
</font></blockquote></div><br></div>