I know this is a strange question but the idea is simple: I prefer C# syntax rather than C++:
-Setters and getters directly inside a property
-interfaces
-foreach statement
-possibility to declare an implicit cast operator
other small things...
What I really don't know is if is possible to import a c++ dll (expecially std libraries) in...
i have a dll, built with mingw
one of the header files contains this:
extern "C" {
int get_mac_address(char * mac); //the function returns a mac address in the char * mac
}
I use this dll in another c++ app, built using Visual C++ (2008SP1), not managed, but plain c++
(simply include the header, and call the function)
But now I ha...
Hello,
I need to call unmanaged COM code from C#.NET. By Loading unmanaged COM Type libraries from (LoadTypeLibEx), I am able to iterate over all exposed types by COM TLB. Now I need to call those exposed methods at run time by knowing their addresses or by accessing some how COM vtable's starting address and by applying indexing for ge...
I have a C# project in which i use several unmanaged C++ functions.
More so, I also have static IntPtr that I use as parameters for those functions. I know that whenever I use them, I should implement IDisposable in that class and use a destructor to invoke the Dispose method, where I free the used IntPtr, as is said in the MSDN page.
p...
I'm in the process of learning C++. I've created a boilerplate Win32 app within VC++ 2008. I've studied through the code and am ready do do a bit of experimenting. I thought it would be cool to print all the windows messages received in the message loop to the form created via the boilerplate code. I for the life of me, can't figure out ...
Hello.
I have the following function written in C#
public static string GetNominativeDeclension(string surnameNamePatronimic)
{
if(surnameNamePatronimic == null)
throw new ArgumentNullException("surnameNamePatronimic");
IntPtr[] ptrs = null;
try
{
ptrs = StringsToIntPtrArray(surnameNamePatronimic);
int resultLen = M...
Hello.
I have the following function written in C#
public static string GetNominativeDeclension(string surnameNamePatronimic)
{
if(surnameNamePatronimic == null)
throw new ArgumentNullException("surnameNamePatronimic");
IntPtr[] ptrs = null;
try
{
ptrs = StringsToIntPtrArray(surnameNamePatronimic);
int resultLen = M...
Hi all,
I've created a class with a boost::unordered_map as a member,
Linkage.h
#ifndef LINKAGE_H
#define LINKAGE_H
#include <boost/unordered_map.hpp>
class Linkage
{
private:
boost::unordered_map<int, int> m_IOMap;
public:
....
};
Linkage.cpp
#include "stdafx.h"
... // methods
and in the managed side of C++,
I t...
I would like to build a small wizard in C++ with no dependencies on any framework.
Apparently, is really simple, but I don't know where to start. Can you point me to good information (tutorials, etc) on it. Should I use MFC Application or a Win32 project? Is there any step by step guide ?
I'm using VS 2010. The majority of info I'd f...
There's another question similar to mine, but I wanted to gather some specifics:
I want to create a DLL that is called from unmanaged code. When the unmanaged functions are called in the DLL, I want to collect information and show it in a kind of form.
What I'd like to do is, when DllMain() is called, and the reason is DLL_PROCESS_A...
Hey
I'm getting this weird error on some stuff I've been using for quite a while. It may be a new thing in Visual Studio 2010 but I'm not sure.
I'm trying to call a unamanged function written in C++ from C#.
From what I've read on the internet and the error message itself it's got something to do with the fact that the signature in my C#...
Hi,
I'm having an issue when calling 32 bit delphi dll's from c# web site. The code generally runs fine, but occasionally I get an error Unable to load DLL '': The specified module could not be found. (Exception from HRESULT: 0x8007007E). This issue persists until I recycle the app pool for the site, and then it works fine again.
On t...
I have written some code in VB that verifies that a particular port in the Windows Firewall is open, and opens one otherwise. The code uses references to three COM DLLs. I wrote a WindowsFirewall class, which Imports the primary namespace defined by the DLLs. Within members of the WindowsFirewall class I construct some of the types de...
I am packing bytes into a struct, and some of them correspond to a Unicode string. The following works fine for an ASCII string:
[StructLayout(LayoutKind.Sequential)]
private struct PacketBytes
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
public string MyString;
}
I assumed that I could do
[StructLayout(LayoutKind....
I get this error return whether I try LsaQueryInformationPolicy() on the local host or on some other machine in the domain. The flags I use for LsaOpenPolicy() are POLICY_LOOKUP_NAMES | POLICY_VIEW_LOCAL_INFORMATION but I also tried POLICY_LOOKUP_NAMES | POLICY_VIEW_LOCAL_INFORMATION | READ_CONTROL without success.
The user I'm logged i...
Hi all,
Is it possible using reflection and C# .NET to call dynamicly different function (with arguments) written in C or C++ before .NET came(unmanaged code) ?
And smole C# example if possible would be appreciated!
Thanks!
Br,
Milan.
...
Hello All,
This question might seem a repeat of previous ones. I have read through a series of posts, but not completely clear for my situation.
I have a c++ library which is created using momentics IDE. I have to be able to use this library into a c# project.
Someone had been working on this project before being handed over to me. Cu...
Maybe I need change the title as "Unmanaged Code calling leads to heavy memory leak!"
The leak is around 30M/hour
I think maybe I need complete my code here because the memory leak maybe not from a static string whereas my real code derive this string from external device (see new code attached). so I handle also unmanaged code. Could ...
Hi
I have to set permissions on a DFS Link with C#. (For adding a DFS Link I used the method NetDfsAdd from the NetApi32.dll. ) After a while searching I found the MSDN Article[0] about NetDfsSetInfo and it describes that I can use this function to set the permissions. But I am a bit confused about DFS_INFO_107 Structure[1] and SECURIT...
I am writing a very high performance application that handles and processes hundreds of events every millisecond.
Is Unmanaged C++ faster than managed c++? and why?
Managed C++ deals with CLR instead of OS and CLR takes care of memory management, which simplifies the code and is probably also more efficient than code written by "a pro...