unmanaged

vshost32.exe crash when calling unmanaged DLL

…衆ロ難τιáo~ 提交于 2019-11-27 05:53:28
问题 I'm using a VS 2005 app to interface against an unmanaged (Fortran) DLL. When I run the compiled executable straight from the command line, everything is fine - the DLL can be accessed, and I can work with the functions in the DLL. Unfortunately, when I launch the app from VS 2005, I get a popup stating "vshost32.exe has stopped working" and no useful debugging information. Has anyone experienced this behavior, or know why this might be occuring? I can't figure out why it would run fine when

Abort call to unmanaged DLL

爱⌒轻易说出口 提交于 2019-11-27 04:26:20
问题 I have an unmanaged DLL with a function that can run for a long time if the input parameter is a large value, sometimes that is desirable but not always. How can I in c# call this function so that I can abort it when needed? So far I have tried to put the call in a separate thread, but neither interrupt nor abort seem to stop the process, which runs at 100% CPU until the dll is done. Is it possible to terminate the running dll code? 回答1: Unmanaged code is only abortable if it is an "alertable

WinApi - GetLastError vs. Marshal.GetLastWin32Error

自闭症网瘾萝莉.ら 提交于 2019-11-27 04:13:48
问题 I tested a lot. But I found no disadvantages of those 2! But see the accepted answer. I read here that calling GetLastError in managed code is unsafe because the Framework might internally "overwrite" the last error. I have never had any noticeable problems with GetLastError and it seems for me that the .NET Framework is smart enough not to overwrite it. Therefore I have a few questions on that topic: in [DllImport("kernel32.dll", SetLastError = true)] does the SetLastError attribute make the

What is meant by “managed” vs “unmanaged” resources in .NET?

六眼飞鱼酱① 提交于 2019-11-26 23:49:24
What is meant by the terms managed resource and unmanaged resource in .NET? How do they come into the picture? The term "unmanaged resource" is usually used to describe something not directly under the control of the garbage collector . For example, if you open a connection to a database server this will use resources on the server (for maintaining the connection) and possibly other non-.net resources on the client machine, if the provider isn't written entirely in managed code. This is why, for something like a database connection, it's recommended you write your code thusly: using (var

Swift - Checking unmanaged address book single value property for nil

拈花ヽ惹草 提交于 2019-11-26 22:25:32
问题 I'm relative new to iOS-Development and swift. But up to this point I was always able to help myself by some research on stackoverflow and several documentations and tutorials. However, there is a problem I couldn't find any solution yet. I want to get some data from the users addressbook (for example the single value property kABPersonFirstNameProperty ). Because the .takeRetainedValue() function throws an error if this contact doesn't have a firstName value in the addressbook, I need to

Is it possible to catch an access violation exception in .NET?

﹥>﹥吖頭↗ 提交于 2019-11-26 22:23:06
问题 Is there anything I can do to catch an AccessViolationException ? It is being thrown by a unmanaged DLL that I don't control. 回答1: You shouldn't. An access violation is a serious problem: it is an unexpected attempt to write to (or read from) an invalid memory address. As John already clarified, the unmanaged DLL might already have corrupted the process memory before the access violation has been raised. This can have unpredicted effects on any part of the current process. The safest thing to

Difference between managed and unmanaged in-app product android?

大憨熊 提交于 2019-11-26 22:21:25
问题 I went through the developer forum to know the difference between managed an unmanaged in-app products. they are saying that "Items that are unmanaged do not have their transaction information stored on Android Market, which means you cannot query Android Market to retrieve transaction information for items whose purchase type is listed as unmanaged. You are responsible for managing the transaction information of unmanaged items." What does it mean? When i test the in-app product for both

Wrapping unmanaged C++ with C++/CLI - a proper approach

岁酱吖の 提交于 2019-11-26 21:37:12
问题 as stated in the title, I want to have my old C++ library working in managed .NET. I think of two possibilities: 1) I might try to compile the library with /clr and try "It Just Works" approach. 2) I might write a managed wrapper to the unmanaged library. First of all, I want to have my library working FAST, as it was in unmanaged environment. Thus, I am not sure if the first approach will not cause a large decrease in performance. However, it seems to be faster to implement (not a right word

How do I call unmanaged C/C++ code from a C# ASP.NET webpage

坚强是说给别人听的谎言 提交于 2019-11-26 21:24:41
问题 I have an ASP.NET website that uses C# and I'd like to call functions from an unmanaged C/C++ DLL. How do I do it? 回答1: Check out P/Invoke. Calling Win32 DLLs in C# with P/Invoke If it's a COM dll, then you can use COM Interop 回答2: create an unmanaged dll: extern "C" __declspec(dllexport) __cdecl int sum(int a,int b); ----> create a namespace/class to DllImport the above DLL using System.Runtime.InteropServices; namespace ImportDLL { public class importdll { public importdll() { } DllImport(

C# “Unmanaged Exports” [closed]

微笑、不失礼 提交于 2019-11-26 20:31:38
I've been trying to use the extension "Unmanaged Exports" by Robert Giesecke in a Visual Studio 2010 pro/C# project. Yet, I can't make it work - when I check the compiled DLL for exports, the viewer ( http://www.nirsoft.net/utils/dll_export_viewer.html ) always comes up empty, no exports seem to be defined at all. I have all but copied the example and set build/config manager/active platform to x86. Can I somehow check if the MSBuild task that does all the magic is actually run or not? What should the project file contain (it seems to be suspiciously empty to me?) I would recommend you do this