managed

fread speeds managed unmanaged

Ok, so I'm reading a binary file into a char array I've allocated with malloc. (btw the code here isn't the actual code, I just wrote it on the spot to demonstrate, so any mistakes here are probably not mistakes in the actual program.) This method reads at about 50million bytes per second. main char *buffer = (char*)malloc(file_length_...

In Eclipse CDT shared resource folder that is built differently for the project

Hi, I have a set of Eclipse c projects that will all refer to a common shared base of code (a mix of .c and .h files in the same folder) but will be built that code differently on a per project basis. The common code base may be edited from within each project but these edits will be fixes to be carried across all the projects. The com...

C# -- Create Managed Array from Pointer

Dear Sirs, I'm trying to create a Managed Array of doubles from an array of bytes. I have the problem working currently, but I wanted to optimize. Here's some code that I would like to work: private unsafe static double[] _Get_Doubles(byte[] _raw_data) { double[] ret; fixed (byte* _pd = _raw_data) { double* _pret =...

Managing destructors of managed (C#) and unmanaged (C++) objects

I have a managed object in a c# dll that maintains an anonymous integer handle to an unmanaged object in a c++ dll. Inside the c++ dll, the anonymous integer is used in an std::map to retrieve an unmanaged c++ object. Through this mechanism, I can maintain a loose association between a managed and unmanaged object using an anonymous inte...

Accessing native C++ data from managed C++

I have an native C++ library which makes use of a large static buffer (it acquires data from a device). Let's say this buffer is defined like this: unsigned char LargeBuffer[1000000]; Now I would like to expose parts of this buffer to managed C++, e.g. when 1000 bytes of new data are stored by the library at LargeBuffer[5000] I would...

How to get Visual Studios build system to understand unmanaged dependencies of managed dlls?

When building managed code Visual Studio correctly (and recursively) copies dlls of referenced managed projects to the output folder of the project being build. However, if one the of those references is a managed DLL that depends on unmanaged dlls then these unmanaged DLLs are not copied to the output folder, even though their corresp...

How to do exception handling in mixed applications? (managed application using unmanaged DLL)

Is it possible to throw exceptions in an unmanaged DLL and handle it in a managed application? My unmanaged C++ DLL throws exceptions in case of errors, and they should be handled in the calling executable application. CMyFileException *x = new CMyFileException; throw(x); This previously worked, but now the application is compiled w...

Convert Unmanaged to Managed During Process Hop

First, I want to thank Matt Davis for this post. I know the post was not chosen as the answer to that specific question, but the post was extremely helpful to me. I had a couple small issues to fix (mostly adjusting the filepaths in the code he provided), but I was easily able to create an unmanaged C++ client for a C# WCF service usin...

JSF Managed Bean auto-create?

Is it possible to have a JSF managed bean be automatically created? For example I have several session scoped beans. Sometimes it becomes necessary to access these instances in code (rather than just in JSF) this is done by: PageBean pageBean = (PageBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("pages...

How to read a managed stream into a uint array directly in C#?

I have some data in a stream which is actually in the format of uint. System.IO.Stream only allows me to read the content out to a byte array, but I don't want to read the bytes and then convert them into a uint array with 1/4 the length of the byte array. I want to read it directly into the memory of the uint array so that it saves time...

Shared memory and strings: managed?

I have a problem with boost::interprocess::string in shared memory. When I use a shared_memory_object I can manipulate a structure with different fields, BUT strings (I get a segmentation fault). On the other side, when I use managed_shared_memory everything is fine. Am I doing something wrong? Do you know if there is a performance...

How to send unmanaged function pointers from dll to another unmanaged function in other dll through managed code?

Hi! I have this problem, which I am dealing with for some time already. At start, I have two dlls with unmanaged code (let's say... dll_1, dll_2) and managed aplication in c#. What i'm supposed to do is to get pointers to unmanaged functions in dll_1 in managed code, pack it into structure, and send this structure as an argument to unman...

adding different language strings to a single resource file

Hey all. I have a small application, which includes a resource (.resx) file. This file contains an icon, and a string, which is used by another application. The icon will be displayed on a button, and the string is the mouseover text. What I want is in some way, to add strings in multiple languages, without having to crate additional ...

.NET wrapper for Windows API functionality

Does anyone know of a .NET managed wrapper around Windows API functionality that is not available in the .NET framework itself? Areas such as window creation and display styles, common UI control manipulation, keyboard/mouse input, file and disk information, memory mapped files etc I have been a regular to visitor http://www.pinvoke...

How does c++ auto_ptr relate to managed pointers (Java, C#...)

I come from a managed world and c++ automatic memory management is quite unclear to me If I understand correctly, I encapsulate a pointer within a stack object and when auto_ptr becomes out of scope, it automatically calls delete on the pointed object? What kind of usage should I make of it and how should I naturally avoid inherent c++...

Create SxS manifest from managed COM assemblies

Hi, I have a C# dll that implements COM. Is there a way to configure the project to create the SxS manifest for this dll (exposing COM information) and embed it into resources. As I understand, running the mt tool as post-build step could be an option. But there are 2 problems: 1. manifest created with mt does not expose the Prog_ID 2. ...

Obtaining COM objects from unmanaged code

I have a library that exports an unmanaged C routine that returns pointers to COM IUnknown-based objects. The DLL is not registered, and is not server. I would like to use the COM types from C#. I have already written C# interfaces for the COM types. What is the C# equivalent of calling LoadLibrary() and GetProcAddress()? How would ...

Howto implement callback interface from unmanaged DLL to .net app?

Hi, in my next project I want to implement a GUI for already existing code in C++. My plan is to wrap the C++ part in a DLL and to implement the GUI in C#. My problem is that I don't know how to implement a callback from the unmanaged DLL into the manged C# code. I've already done some development in C# but the interfacing between manage...

Inject managed DLL into native process problem

I need to subclass a richedit control in a chat program (I am trying to make a musicbot). I dont know how to code in c/c++ but i was able to use c++ to inject a managed code into the chat program using CLR Hosting. But couple problems occurs. Hopefully I can get some help from here. My managed code would exit after it finished the thre...

How do I create a non managed Windows GUI in Visual C++?

When I create a 'Windows Forms Application', the resultant program is a managed one. Creating a 'Win32 Application' results in a native one, but when I try to add a form I'm informed that the project will be converted to CLI if I continue. How do I design a native Windows GUI with Visual C++ 2008 Express Edition? I'm probably being very ...