Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C++ dll in C# code
Message
From
13/05/2014 02:33:20
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01599867
Message ID:
01599904
Views:
121
>>>>Your app. needs to be able to find this DLL. I usually add the DLL to the project (not as a reference, just to the project) then select it and set "Copy to Output Directory" to "Copy always".
>>>
>>>Do you know how should I figure out the problems? I've been debugging the test. When I come up to the Invoke1 line I saw a call to Request.Dispose method (request is a separate class that implements IDisposable interface) and then the test ended. So, I assume that this call somehow interrupted the whole thing.
>>
>>I'd start with the basics - what are the dependencies of the C++ DLL - are they all available? Are you absolutely sure things like pathing is what you're expecting it to be (check, don't assume)? Does it access the network - are there permission issues?
>>
>>If I had the C++ code (or at least PDBs for them), I'd enable native debugging in Visual Studio, add the project into my .NET project, then set a breakpoint in the native C++ code (there are other ways to do the same thing).
>>
>>The other question I'd have is what type of strings does the C++ DLL expect? Default is BSTR. If it expects anything else, you would need to specify this in the DllImport / P/Invoke code.
>
>I can download the code for this DLL although I didn't want to. I hoped I can just use it as is (it is used from VFP fine). I believe this DLL may want to access SQL Server data.
>
>The developer suggested the following code to use
>
>
>  [DllImport("ww_local.dll", CallingConvention = CallingConvention.Cdecl)]
>        static extern string Invoke1(string str);
>
>
>so I used it as it. I hope I can involve him directly because I really don't want to go deep into VC++ code or even download it.
>
>Also, when I tried to open this dll with dependency walker, I got an error.
>
>
>Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
>Error: Modules with different CPU types were found.
>Warning: At least one delay-load dependency module was not found.
>Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
>
>
Have you looked at the dll in a dependency walker and verified the required dependencies are in place ?
Is the DLL publicly available ?
Previous
Reply
Map
View

Click here to load this message in the networking platform