This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Possible to use pinvoke to call DLL built with cygwin
- From: "Sammy Yu" <temijun at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 1 Nov 2006 11:44:51 -0600
- Subject: Possible to use pinvoke to call DLL built with cygwin
Hi guys,
I'm trying to port an application onto Windows that was originally
developed for UNIX using rpc, pthreads, and AF_UNIX sockets. I have
used cygwin to compile this application successfully. One of the
components built is a DLL which I want to invoke from a C Sharp
application. However, the application crashes whenever I call this
DLL via pinvoke in C Sharp.
************** Exception Text **************
System.DllNotFoundException: Unable to load DLL 'perm.dll': Invalid
access to memory location. (Exception from HRESULT: 0x800703E6)
at WinPcapRedirectorUI.Perm.meme ()
at WinPcapRedirectorUI.MainForm.statisticsButton_Click(Object
sender, EventArgs e) in
C:\eclipse\workspace\winperm\WinPcapRedirectorUI\MainForm.cs:line 74
at System.Windows.Forms.Control.OnClick (EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
I verified that the cygwin*.dll are in the path. I made a strip down
version of a dll, it exhibited the same behavior. Next, I compiled
the
library with -mno-cygwin flag which surprisingly worked. I suspect
that cygwin1.dll does not work with pinvoke. Can anybody confirm this
is true? I prefer not to have to port the native application to
Visual C or mingw32 as there are a lot of rpc and AF_UNIX sockets.
Are there any other alternatives? Thanks in advance for your help!
Regards,
Sammy Yu
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/