I'm having some problems calling a C function from a DLL, and was hoping someone could help me out. The function is returning -101 which translates as a "bad parameter". The values I am passing have been returned from another, successful function call, so my current assumption is that I've built the structure incorrectly. Any help is ...
I'm creating a web service in Java that will be consumed by an external application, probably written in C#. In my Purchase bean, I have a Currency object for the total cost. However, this leads to the following error:
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.util...
I have a native C++ application that, for the time being simply needs to send its command line string and current mouse cursor coordinates to a WPF application. The message is sent and received just fine, but I cannot convert the IntPtr instance in C# to a struct.
When I try to do so, the application will either crash without exception ...
This is what I tried
f = 1.2
f = Marshal.dump(f) #\004\bf\v1.2\00033
after that I tried to save this f into text column and this is an error I got.
ActiveRecord::StatementInvalid: SQLException: unrecognized token: "fϾ1.2 33" (Ͼ is male symbol, but I can't find one).
...
Hi there!
I'm writing a program to do some image processing on the GPU. For this I'm using CUDA.Net, but unfortunaly the CUDA doesn't recognize the type byte, in which I was able to store the pixels information using this code:
BitmapData bData = bmp.LockBits(new Rectangle(new Point(), bmp.Size),
ImageLo...
I have the following .NET value types:
[StructLayout(LayoutKind.Sequential)]
public struct Date
{
public UInt16 V;
}
[StructLayout(LayoutKind.Sequential)]
public struct StringPair
{
public String A;
public String B;
public String C;
public Date D;
public double V;
}
I have code that is passing a pointer to a v...
My application requires to keep large data objects in session. There are like 3-4 data objects each created by parsing a csv containing 150 X 20 cells having strings of 3-4 characters.
My application shows this error- "marshal data too short".
I tried this-
Deleting the old session table.
Deleting the old migration for session table.
...
How to convert this code:
MYCLASS ebt = new MYCLASS();
ebt.cbStruct = Marshal.SizeOf(ebt);
into this:
MYCLASS ebt = new MYCLASS(cbStruct = Marshal.SizeOf('What comes here?'));
...
Sorry for the verbose introduction that follows. I need insight from someone knowing P/Invoke internals better than I do.
Here is how I'm marshalling structures containing function pointers from C to C#. I would like to know whether it's the cleanest and/or most efficient way of doing it.
I'm interfacing with a native DLL coded in C th...
I am trying to determine if the COM interop is becoming a bottle neck in my software. This article on MSDN helps http://msdn.microsoft.com/en-us/library/ms998579.aspx#scalenetchapt15%5Ftopic11. But I really do not have have a point of reference for a "normal" or "high" value for # of marshalling to determine if it is impacting performanc...
>>> idmapfile = open("idmap", mode="w")
>>> pickle.dump(idMap, idmapfile)
>>> idmapfile.close()
>>> idmapfile = open("idmap")
>>> unpickled = pickle.load(idmapfile)
>>> unpickled == idMap
False
idMap[1]
{1537: (552, 1, 1537, 17.793827056884766, 3), 1540: (4220, 1, 1540, 19.31205940246582, 3), 1544: (592, 1, 1544, ...
I am calling a DLL using PInvoke. The DLL's function returns a C string in codepage 437.
Is there a way to have the .Net marshaling convert the string to unicode, or could someone suggest which parameters I should give to DllImport() and MarshalAs() and a conversion function to use in order to get an output in unicode?
For reference, t...
I have a C++ struct that looks like this:
struct unmanagedstruct
{
int flags;
union
{
int offset[6];
struct
{
float pos[3];
float q[4];
} posedesc;
} u;
};
And I'm trying to Marshal it like so in C#:
[StructLayout(Layou...
I've got a few classes that implement Parcelable and some of these classes contain each other as properties. I'm marshalling the classes into a Parcel to pass them between activities. Marshalling them TO the Parcel works fine, but when I try to unmarshall them I get the following error:
...
AndroidRuntime E Caused by: android.os.BadPa...
Hi,
I'm using Marshal.Copy() to copy the pixel information from a Bitmap to an int[] array, the problem resides in the fact that the information that is coming to this array is coming all wrong, like:
[0] = -8682109;
[1] = -8682109;
[2] = -8616573;
[3] = -8616573;
[4...
I posted a question not to long ago about how my program was essentially leaking memory: see here. I have now tracked it specifically to some code in which I copy the raw bytes of a Bitmap object into a managed array. The relevant code:
public class FastBitmap
{
...
private byte[] rgbValues;
private int height;
private i...
I'm trying to subclass an unmanaged statusbar window from my managed COM server using a class inherited from NativeWindow, and am running into a wall trying to make sense of how to properly marshal the contents of an lParam.
http://msdn.microsoft.com/en-us/library/bb760757%28VS.85%29.aspx says that the contents of this lParam is of type...
I'm working with an unmanaged library through P/Invoke and it uses three structs (although they all have the same basic layout, so I'll only post one):
struct Agraph_t {
int tag:4;
int kind:4;
int handle:24;
char **attr;
char *didset;
char *name;
Agdata_t *univ;
Dict_t *nodes, *inedges, *outedges;
Agr...
Hello Folks,
json support is one of the new features of delphi 2009 and delphi 2010. I want to know if it's there any simple function to marshalling/unmarshalling directly between string and object like in superobject library.
Example:
MyKnownObject := FromJSON('{name:"francis", surname:"lee"}');
...
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...