passing a struct to an unmanaged dll

I am confused about the abnormal behaviour of my project. Please consider the following situation:I have written an application in C++.NET 2003 (managed) which loads and executes an unmanaged function from an unmanaged dll. On the dll-side i export this function:typedef struct {int a;int b;...} myst ...

calls to unmanaged dll to create a socket result in debug assertion

I have an unmanaged C++ dll which is an MFC shared DLL that has functions in it to initialize sockets and do other ethernet related things. I have built a managed C++ wrapper project which is also an MFC shared DLL, compiled with /clr that calls functions in the unmanaged dll. Then I have a C# proje ...

Unmanaged dll with managed code

We are using managed C++. I want to use unmanaged dll in managed code. What I m doing right now is:1. In Solution Explorer, click the project node->Add Reference->Right click->Add reference.2. In the Add Reference dialog box, click the COM tab. 3. Click Browse, and then select any Interop a ...

Calling unmanaged dll function with void* parameter

I really need little help with unmanaged dll access from VB.NET, have been working on it about a week. I have a C++ .h files with headers. I have to access one function from the dll using VB.NET:intacsGetEventPoll (int acsHandle,void FAR *eventBuf,unsigned short FAR *eventBufSize);Documentation says ...

pass parameter to unmanaged DLL

I have a C++ unmanaged DLL mydll. It has a exported function myfunc(float** buffer, int size). The buffer will store the returned result.I tried wrapper it into C# dll so I write a wrapper class for it. The function runmyfun will call the function myfun() in unmanaged dll mydll and return the result ...

passing parameters to unmanaged DLL in C#

I have a C++ unmanaged DLL mydll. It has a exported function myfunc(float** buffer)I tried to used it in C# so I write a wrapper class for it.public class CDllWrapper{ ...

Problem with using unmanaged DLL in C# app

HiI'm having trouble finding exactly how to import and use a unmanaged DLL in my C# app.The DLL I'm trying to use is this one:http://www.barcode-manufacturer.com/magnetic_card/portable_magstripe/mse630tdll.htmlC# code I'm using:private void button1_Click(object sender, EventArgs e){IntPtr status = C ...

Calling managed code from my unmanaged DLL

I currently have an unmanaged DLL written in C++ and I can call the exported methods in this DLL from my C# app without any problems and it works quite well.Now, I need to call from this DLL a method in my managed app. Is it possible to do so? What do I need to do so that the managed method is visib ...

Passing array of struct as argument to unmanaged DLL

I'm currently working on a project that dynamicaly load an unmanaged dll and use it. Everything works fine unless for a specific fonction that take a structure array as an argument. The function is supposed to fill the array with correct values, but after the method ends, all data in my struct are o ...

Passing structure containing pointer from C# to unmanaged dll

How can I pass following structure from c# to unmanaged dll ?typedef struct _TEST_{int length;BYTE *byData} TEST; ...

help:To develop unmanaged DLL in C++ that interacts with C++ App1 & C# App2

My scenario is like this.I have to develop an unmanaged DLL (in C++) which will run as part of Application1. "MyDLL" will export functions using __declSpec(dllexport) and make them available to Application1.i have another Application2 which is in C#. Application2 uses .NET remoting to achi ...

Call Unmanaged DLL with Japanese strings

My machine's system locale and user locale are both English (en-US).I have created a form using C# which simply captures the data entered in an edit box and calls an unmanaged C++ DLL.public partial class Form1 : Form{[DllImport("TestDll.dll")]public static extern int WriteMyFile(ref MyGlo ...

Passing Message from unmanaged dll to C# Windows Service

I have an unmanaged dll written in VC++ 6.0. I want to pass my custom messages from dll to C# application. C# application should retrieve this message from its message queue. My problem is that i want to run that C# application as Windows Service without UI and i need a mechanism of Message loop wit ...

How to get BYTE array allocated in Unmanaged DLL ???

I’m using an unmanaged DLL wartime in C that exports the function:void Get (BYTE** pByte);This function fills the pByte with a BYTE buffer that is allocated inside the unmanaged DLL.How do I use this function from a C# code?I tried:[DllImport("Unmanged.dll")]public static extern void Get( ...

How to call the callback functions in unmanaged dll

I am using an unmanaged dll in my c#.net project.The dll uses some callbackfunctions which retrieve the status of the file stored.I am new to delegates.Can anyone provide me a solution for how should I use those callback functions in my project using delegates?I am pasting the information of functio ...

Calling unmanaged dll functions in managed c++

I have a windows forms application that is written in Managed C++. I'm at a point where I need to use a dll that is unmanaged. I'm just not sure how to start. I'm confused about the whole import export thing. Any pointers on how to go about this?? ...

Calling unmanaged dll class functions from managed dll

I am trying to create a managed dll in managed C++. I am trying to call a class method that is exported by a dll written in unmanaged way.I am able to declare an object of the class, but when I call a method, I get following errors.DotNet error LNK2001: unresolved external symbol __load_config_usedD ...

Marshalling and callback with Unmanaged dll

I have the following structures in a C dll,In C: typedef struct Structure1{SomeStruct list1;// Somestruct is a structureSomeStruct List2;SomeEnum state; // SomeEnum is a Enumunsigned char *pcurrent;unsigned short Length;SomeStruct addr;SomeStruct timer;unsigned short retries;unsigned char flag;unsig ...

Shared memory w/ unmanaged DLL

This is my first excursion into .NET development, so please forgive any novice oversights...I'm trying to write a C# application that accesses shared memory in an unmanaged Win32 DLL.The Win32 DLL defines the shared memory in such a fashion:// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ...

problem passing managed form's handle to unmanaged dll native code function

I want to call the following function in a native code dll from my managed code:bool myInstallFunc(HWND hWnd, LPTSTR param1, DWORD param2, LPTSTR param3);I tried this in my code but i get all sorts of errors but i think the format is correct........[DllImport("myInstaller", CharSet=CharSet ...

stl in unmanaged dll used by managed code

I've just written a standard win32 dll that uses stl containers and exports several functions that take references to strings and vectors and lists etc.. But now I've been told that this dll might be used by a managed executable. Should I abandon the use of stl objects and rewrite the dll or try to ...

Need Help With Pointers And Unmanaged DLL

I'm trying to add a feature to my program that will allow me to play .spc audio files (SNES Music) using SNESAPU.DLL, which I believe is written in C++. The author of the dll has provided documentation for it, but I am having a very difficult time implementing it into my program... namely because it ...

call an unmanaged function of an unmanaged DLL

I have a DLL which exports some function retunring strange things: a pointer to BYTE in output, a callback function in input.The functions i have in c++ unmanged are the following:extern int WSC_ImpostaBuffer(unsigned char ucCodiceComando, unsigned char *pucReturnBuffer,unsigned int *pdwRetLung, uns ...

prodding the unmanaged dll

I read the following article on P/Invoke which I found very informative:http://msdn.microsoft.com/msdnmag/issues/03/07/net/I am trying to tie up a C# GUI to a dll created by Matlab/Simulink from Mathworks. This is a real time model which is converted in C then compiled to a dll. It has a number of f ...

Injecting unmanaged DLL and inter-process communication

So im injecting dll to the outer process and i would like communicate/send commands to created thread. For my learning process i chose sockets as the first attempt. I have already written the server code/class. Now before making the simple client layer i have started wondering how am i suppose to pa ...

Unmanaged C++ dll taking CString as parameter crashes my app!

I had to import in .NET a DLL with a function that takes as input some CString arguments.So I developed a little wrapper dll for this function containing an unmanaged function that takes as input some const char*,"translates" them into CString and then passes them to the original Dll in su ...

Is it possible to convert UnManaged VC DLL to Managed?

Is it possible to convert a unmanaged VC++ DLL to Managed one so that it can be used as a Managed DLL in C# clients.Like currently an Unmanaged DLL can be accessed from C# clients using PInvoke(DllImport). But is the conversion possible so that i can add a reference to the dll from any client. ...

Help:In developing unmanaged C++ DLL that should interact with C++ Application1,and..

My scenario is like this.I have to develop an unmanaged DLL (in C++) which will run as part of Application1. "MyDLL" will export functions using __declSpec(dllexport) and make them available to Application1.i have another Application2 which is in C#. Application2 uses .NET remoting to achi ...

Unmanaged C++ Dll To Managed

Here is my problem!I'm trying to use a Unmanaged dll (Use of MFC) into a C# project. But I know I have to wrap it before I can use it! So I've tried to wrap it without any success ! I'm new in this kind of prog and I would like some help !!!Here is a sample of the code of the unmanaged .h I want to ...

How to call unmanaged C++ DLL with a CString reference

I am building a managed C++ wrapper DLL around an unmanaged C++ DLL that uses MFC CStrings. The unmanaged C++ DLL contains a class that I need to access. My problem is that this class contains methods using CString references, such as:void SetName(const CString& name);How can I call this method ...

C# Project usind unmanaged C++ DLL

I'm working on a C# project under VS . NET and I try to include an unmanaged DLL via [DllImport("blabla.dlll", CharSet=CharSet.Auto)]followed by function name and paramters.The DLL contains may, many function names, which I want to use in my C# project.Is there a code generating tool, whic ...

Unmanaged classes in DLL's and using them in c# / managed c++

I have got some code in an unmanaged DLL consisting of some classes and the like that perform some image processing. My problem is that I need to create instances of one of those classes that are in the unmanaged DLL at runtime from ideally C# or managed C++. How can I do this as I have been lead to ...

Line Drawing DLL

I am creating an eLearning project to educate students that lets them draw diagrams. This is mostly completed using an eLearning authoring program*. But, the one feature that this program does not create is ability to draw lines (about 7 line types-solid, dotted, arrow-headed, etc.) on-the-fly betwe ...

Call external dll from other dll and expose it

I had to import in .NET a DLL with a function that takes as input some CString arguments.So I developed a little wrapper dll for this function containing an unmanaged function that takes as input some const char*,"translates" them into CString and then passes them to the original Dll in su ...

DLL's and struct's as parameter

I've written an (unmanaged) dll which exports__declspec(dllexport) int do_work( struct_type * results );where struct_type is justtypedef struct {long a;long b;...}Ok. This works fine, I wrote a test-program.Now, I have to use this dll in an (managed) Visual C++ .NET (2003) application.There also, th ...

Unable to load DLL 'my.dll' 0x8007007E

I have a very frustrating problem that I just can't figure out how to resolve as it makes no sense.1) I have a c++ unmanaged DLL compiled in VS2005 which provides services to a web project2) I have a c# asp.net project which imports functions from the the dll in #1When I run the web project, I getUn ...

How to Quantify .NET unmanaged component?

I'm using Quantify for Windows. I have a C# app that references a DLL written in C# (managed), which in turn loads a DLL written in C (unmanaged). I am able to Quantify the managed component, but has problem with the unmanaged. Select the Unmanaged radio button in Quantify won't go all the way down ...

Article: Consuming Unmanaged C++ Class Libraries from .NET Clients

i read that arcticle "Consuming Unmanaged C++ Class Libraries from .NET Clients"URL: http://codeguru.earthweb.com/cpp/cpp/cpp_managed/interop/article.php/c6867/It's about writing a managed a managed wrapper around an unmanaged C++ class library.Now I'wondering if it's somehow possible to l ...

Marshalling problem (managed to unmanaged)

HOPEFULLY someone can help me.I am trying to access a function from an unmanaged DLL from my visual c++ managed GUI.Declaration of the function I am trying to import from unmanaged (native) DLL is:extern "C" __declspec(dllexport) TGrayImage<int>* init_seg(TGrayImage<float>* pIm ...

Unmanaged C++ to C#

Heres the situation:I have unmanaged (Non .Net) C++ DLL in which I can edit the source for.my goal is to build a GUI interface in C# that will use the unmanaged DLL.What should my technique be to accomplish this? ...

Passing std::string to constructor of unmanaged class

I have an unmanaged dll (written in VC++ 6.0) that implements a class CUnmanaged. The class has the following constructor:CUnmanaged::CUnmanaged( const std::string& filename ){/* ... */}I have a client application (written in VC++ .Net) that uses the above class dll as follows:CUnmanaged* oserr ...

Passing ostream object to an constructor of unmanaged class...

I have an unmanaged dll written in C++ using Visual Studio 6.0. I need to use this dll in an VC++ .Net application. The unmanaged dll has a class called CUnmanaged. Its constructor accepts reference to ostream object:CUnmanaged::CUnmanaged( ostream& os ){/* ... */}In the VC++.Net client applicat ...

unmanaged to managed code conversion

I have an unmanaged DLL,I want to convert this to a Managed code so that C# and VB can access the resulting managed DLL, we decided to use Managed Extensions for C++(MC++)As i am facing difficulties in analyzing the concepts hidden with in MC++,i want to know as1.how to take the existing unmanaged c ...

Setting array value in unmanaged code

HiI am using a unmanaged dll ( C++). That dll contains a structure like this.TestStruct {int structsize;int steps;double arr[100];int data;};The problem is that I am able to access all the data memebers of this structre except array. You know in vb.net we have to redim array. When I redim array it c ...

trouble using unmanaged c++ from c# using dllimport

i am having trouble importing c++ unmanaged dll into C# [winform]. Can someone help?Basically i am just trying to create a safearray of strings in c++ and trying to send it to C#.Here is my c++ code.extern "C" __declspec(dllexport) BOOL GetStringArr(SAFEARRAY* arr){SAFEARRAY* myArray;SAFEA ...

Access violation Exception inUnmanaged dll

What might be the causes of access violation exception when calling functions from an unmanaged dll ? ...

C# and .NET DLL loading

I'm new to .NET and C#. I have written an unmanaged DLL in Visual C++ to access a piece of equipment.In my main app, if I have multiple pieces of equipment, my initial thoughts were to have several 'copies' of the DLL, one per equipment. However, I can't see, based on how I call the DLL methods usin ...

How to use an unmanaged structure

My program receive a pointer of an unmanaged structure, coming from a callback of an unmanaged dll:public static void my_callback_function(IntPtr pointer_of_the_unmanaged_structure, ...)I would like to create a managed structure from this unmanaged structure. I think I have to use "Marshal ...

to create dll

HiI found the way to access unmanaged *.dll from .NET C# code as [DllImport (*.dll")].Then how to I parepare to create dll in .NET C# which will be used in unmanaged C++ code?Does anyone help this? ...

Communication Between Managed And Unmanaged Applications

I have two applications that need to communicate. One is written in C++ and must run as quickly as possible. The other is a user interface written in MFC. Communication between the two applications is currently performed using shared memory. I wish to write a new user interface in C# using the .NET ...