Reputation: 213
I call a DLL in ASP.NET a DLL that is written in C++. When running it into IIS 7, The pool (w3wp.exe) crash and the "just in time debugging window" open.
I do many tracing and I found that crash happen when calling any function (in the unmanaged DLLs) that have a "out string" parameter (or return a string value).
I saw on the web than many people have this problem with their DLL (C, Delphi, VB6). But no answer. so I call experts!
How can I call these functions so IIS 7 process it without error ?
cas sakal
Upvotes: 0
Views: 1096
Reputation: 160992
You should use StringBuilder
for interop string output parameters:
[MarshalAs(UnmanagedType.LPStr)] StringBuilder myString
Upvotes: 1
Reputation: 6846
It may not be possible. COM provides an interface specification, but not a guarantee that the caller be able to use the interface correctly. Unless the COM object exposes methods which are automatically marshalable by the COM subsystem (eg: automation compatible), you may not be able to use them. It's easily possible to write a C++ COM object which cannot be directly accessed out-of-process, or by any language other than C++.
You may be able to write some custom marshaling code to make it work, but I wouldn't assume it will work directly. If the types are simple/direct enough, there may be some built-in marshal attributes to make it work; I don't have a lot of knowledge in this area, though, so hopefully other people can help out.
Upvotes: 0