Re: Using Cygwin to yield a Windows DLL

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Thanks Carlos and Ben. Your answers are very insightful.

Hello Oriane,

Thanks for using Microsoft Newsgroup Service. My name is Hongye Sun [MSFT]
and it is my pleasure to work with you on this issue.

This issue is related to P/Invoke and Cygwin. I am NOT familiar with
Cygwin. What I can do to support you is to find what causes
DllNotFoundException and if it is resolvable without Cygwin support.

DllNotFoundException occurs when the DLL specified in DLLImport or its
dependency DLLs cannot be found. In order to find which DLL is not found,
please use the tools below:

1. Process Monitor
a. Downloaded it at
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx.
b. Open it, and click "Capture (Ctrl + E)" button to stop capturing.
c. Click "Clear (Ctrl + X)" to clear the existing trace.
d. Only enable "Show File System Activity"
e. Run your C# application in Visual Studio in debug mode and set
breakpoint to the line to call P/Invoke method.
f. When the breakpoint breaks to that line, switch back to Process Monitor
and start capturing.
h. Switch back to Visual Studio and step over that line to make the
DllNotFoundException occurs.
i. Go back to Process Monitor and stop capturing
After the steps above, you can analyze the logged activities and find which
dll is not found.
You can also send it to my email address hongyes@xxxxxxxxxxxxxxxxxxxx,
remove 'online.', so that we can do analysis for you.

2. Dependency Walker
It can be downloaded at http://www.dependencywalker.com/
Use it to open the DLL that you want to do P/Invoke and check error log to
see if there is any unresolved DLL dependency.

3. Send DLL to us
It would be very helpful if you can send us the DLL specified in DllImport
(Also created by Cygwin). We can use it to reproduce the error in our lab.

After searching on internet, we found that someone has successfully done it
by using Cygwin + MingW. It is blogged at
http://kpowerinfinity.spaces.live.com/Blog/cns!EEA9A8ECBFC1B50B!222.entry.
By using MingW, it eliminates the dependency on cygwin1.dll. After doing
tools check above, we can know if cygwin1.dll is the root cause of the
problem.

Please let us know the result of the tools check. We will be waiting for
your reply. Thanks.

Regards,
Hongye Sun (hongyes@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

This posting is provided "AS IS" with no warranties, and confers no rights.

.


Quantcast