This is a repost as I didn't get a reponse to my last one and I still can't get this thing to run through. Well I lie. It ran through fine once, but since then I've been getting this contextSwitchDeadlock issue, but I haven't modified the code!
Anyone have any ideas?
Hi All,<br />
I'm slowing finding my way around C#.<br />
I have written an application that takes a directory, take each file in that directory and also each file in each subdirectory, and then trys to find any files with the same name<br />
(Trying to clear up all my duplicate photos )<br />
SO I have written the code, and checked it and checked it again, it does not get caught in an infinite loop.<br />
But when I F6 the app it comes up with a ContextSwitchDeadlock MDA issue.<br />
There is a program calling a C++ dll named "ffisamp.dll".
The C++ code is as follows:
//Simple C function that just puts something in a string
// and returns the length of that string both as the RC and as a param
// Keeping the C interface as simple as possible.
__declspec( dllexport ) int PopulateString ( char *FormsBuffer, int *BuffLen)
strcpy(FormsBuffer,"A Fixed string from within the C program");
*BuffLen = strlen(FormsBuffer);
LocalLength = strlen(FormsBuffer);
I need C# code that will compile to a dll that mimics the sample dll such that no modifications will need to be made to the calling program. I need to be able to just replace the old dll with the new one.
I am most perplexed that the C++ method is not in a class. That might be that the source code is just a snippet of the whole dll's source code... since it comes from a sample, but I have the impression from the documentation that is all of it. Here is a link to the article I am working with. I am trying to communicate with an Oracle 10g form using methods to call C functions.
AFAIK that's not possible.
C# is managed code, while C++ is unmanaged code. Data and object marshaling in both is very different -not to mention the structure of the dll file, and the method of function exporting-.
If you do, then why didn't you tell us how to do it!
Yes, it's possible somehow, but not in his scenario. You may mean the COM wrapper of DotNet that enables you to make your objects COM visible. He wants to make a C# dll for a program that references a C++ dll without COM, and my bet is that the program doesn't expect a managed code either. Also note that the function doesn't belong to a class which is not allowed in C#.
As already explained by others, C# can only produce managed code, while your sample is an unmanaged DLL. There are several ways to implement managed-unmanaged interoperability, but there is no simple solution for what you want to do.
One idea that come to my mind requires the creation of two DLLs:
One unmanaged C++ DLL that exports your required method and transforms it into a COM method call. And a COM server DLL that provides the method consumed by the first DLL. The second DLL can be written in C# as managed DLLs can be designed to be callable by COM clients (CCW).
I would like to add a new row in my datagrid, which is the summary of the other rows in the datagrid. Much like a "Total" row in excel spreadsheet. Thing is, when my user sorts the datagrid by clicking one of the column headers, I would like this Summary row to stay at the bottom. Have done my research but the only thing I came across when it comes to sorting is the AllowSorting() method.
Also, it would be great if I can have my first column also frozen when I scroll to the right, such that the user will be able to see to which row header the value belongs to without having to scroll back to the left everytime.
Thanks in advance!