C# Web Service Cannot find my DLL with P/Invoke

Siegfried Heintze <[email protected]> Thu, 24 Jun 2004 22:38:35 -0600
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <200406242240390.SM01156@fasolt>
I have the following code in my web service:



                [DllImport ("CaseAssessment.dll",
CallingConvention=CallingConvention.Cdecl)] public static extern double
add_(double X, double Y );



                [WebMethod] public double add (double X, double Y){



                         return add_(X, Y);



            }





I ran www.dependencywalker.com <http://www.dependencywalker.com/>  on
CaseAssessment.dll and it reported no dependencies (except ntdll.dll). This
web service is on a remote hosting service so I cannot put the DLL in the
system32 directory.



When I try to call the add function from my C#  SOAP client it comes back
and tells me it (I presume the server) cannot load the DLL. Quite some time
ago someone responded to my query on one of these mailing lists and informed
me that she thought the rules for loading a DLL from a web service included
looking in the current directory (which is not the default directory for
IIS/InetInfo/ASP.NET).



Is this incorrect? How do I load a DLL from a web service?



Can I use LoadLibrary/GetProcAddress from C#? Uhgggh! I hope this is not
necessary.







   Siegfried