I am calling an unmanaged DLL like follows in a Class wrapper.
namespace blah
{
[DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint",
CallingConvention=CallingConvention.ThisCall]
public static extern void blahFn(out long blah, out long blah2);
class sealed ClassBlah
{
private ClassBlah()
{
}
}
}
Why have I to call this with the CallingConvention of ThisCall, its just
normal "C" functions in a DLL. Why wont StdCall work?
What happens with other calling conventions is that the out parameters are
NOT set, yet with ThisCall, they are set ok, or appear to be. I find it odd.
Thanks 11 2411
Mr. Tickle,
What is the declaration of the original function? If it takes a
pointer, then you should be using "ref" for the parameters, and not out.
Also, does the function take a 64-bit integer? Long in C is a 32-bit
integer, where in .NET it is a 64-bit integer.
The STDCALL mechanism should work if you are using it.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl... I am calling an unmanaged DLL like follows in a Class wrapper.
namespace blah { [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", CallingConvention=CallingConvention.ThisCall] public static extern void blahFn(out long blah, out long blah2);
class sealed ClassBlah { private ClassBlah() { }
} }
Why have I to call this with the CallingConvention of ThisCall, its just normal "C" functions in a DLL. Why wont StdCall work?
What happens with other calling conventions is that the out parameters are NOT set, yet with ThisCall, they are set ok, or appear to be. I find it
odd.
Thanks
Nop, I tried ref and it doesnt help, the only way i can get it to return
values is with thiscall.
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:#p**************@TK2MSFTNGP11.phx.gbl... Mr. Tickle,
What is the declaration of the original function? If it takes a pointer, then you should be using "ref" for the parameters, and not out. Also, does the function take a 64-bit integer? Long in C is a 32-bit integer, where in .NET it is a 64-bit integer.
The STDCALL mechanism should work if you are using it.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:Oo**************@TK2MSFTNGP09.phx.gbl... I am calling an unmanaged DLL like follows in a Class wrapper.
namespace blah { [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", CallingConvention=CallingConvention.ThisCall] public static extern void blahFn(out long blah, out long blah2);
class sealed ClassBlah { private ClassBlah() { }
} }
Why have I to call this with the CallingConvention of ThisCall, its
just normal "C" functions in a DLL. Why wont StdCall work?
What happens with other calling conventions is that the out parameters
are NOT set, yet with ThisCall, they are set ok, or appear to be. I find it odd.
Thanks
So i should use Int32 for the parameters instead of long?
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:#p**************@TK2MSFTNGP11.phx.gbl... Mr. Tickle,
What is the declaration of the original function? If it takes a pointer, then you should be using "ref" for the parameters, and not out. Also, does the function take a 64-bit integer? Long in C is a 32-bit integer, where in .NET it is a 64-bit integer.
The STDCALL mechanism should work if you are using it.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:Oo**************@TK2MSFTNGP09.phx.gbl... I am calling an unmanaged DLL like follows in a Class wrapper.
namespace blah { [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", CallingConvention=CallingConvention.ThisCall] public static extern void blahFn(out long blah, out long blah2);
class sealed ClassBlah { private ClassBlah() { }
} }
Why have I to call this with the CallingConvention of ThisCall, its
just normal "C" functions in a DLL. Why wont StdCall work?
What happens with other calling conventions is that the out parameters
are NOT set, yet with ThisCall, they are set ok, or appear to be. I find it odd.
Thanks
I also have a problem with "ref" paramaters, it says they need to be
assigned to before used
Yet i have them used as "ref" in dll extern calls and checked for non NULL
after yet it complains for non assignment so i use a local copy.
Isnt it smart enough to detect that its being assinged in an extern dll call
as declared in DllImport?
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:#p**************@TK2MSFTNGP11.phx.gbl... Mr. Tickle,
What is the declaration of the original function? If it takes a pointer, then you should be using "ref" for the parameters, and not out. Also, does the function take a 64-bit integer? Long in C is a 32-bit integer, where in .NET it is a 64-bit integer.
The STDCALL mechanism should work if you are using it.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:Oo**************@TK2MSFTNGP09.phx.gbl... I am calling an unmanaged DLL like follows in a Class wrapper.
namespace blah { [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", CallingConvention=CallingConvention.ThisCall] public static extern void blahFn(out long blah, out long blah2);
class sealed ClassBlah { private ClassBlah() { }
} }
Why have I to call this with the CallingConvention of ThisCall, its
just normal "C" functions in a DLL. Why wont StdCall work?
What happens with other calling conventions is that the out parameters
are NOT set, yet with ThisCall, they are set ok, or appear to be. I find it odd.
Thanks
i mean "out" oops.
ref in the same dll wrapper still gets the output but only with thiscall
convention.
"Mr.Tickle" <Mr******@mrmen.com> wrote in message
news:OQ**************@TK2MSFTNGP09.phx.gbl... I also have a problem with "ref" paramaters, it says they need to be assigned to before used
Yet i have them used as "ref" in dll extern calls and checked for non NULL after yet it complains for non assignment so i use a local copy.
Isnt it smart enough to detect that its being assinged in an extern dll
call as declared in DllImport?
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com>
wrote in message news:#p**************@TK2MSFTNGP11.phx.gbl... Mr. Tickle,
What is the declaration of the original function? If it takes a pointer, then you should be using "ref" for the parameters, and not out. Also, does the function take a 64-bit integer? Long in C is a 32-bit integer, where in .NET it is a 64-bit integer.
The STDCALL mechanism should work if you are using it.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:Oo**************@TK2MSFTNGP09.phx.gbl... I am calling an unmanaged DLL like follows in a Class wrapper.
namespace blah { [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", CallingConvention=CallingConvention.ThisCall] public static extern void blahFn(out long blah, out long blah2);
class sealed ClassBlah { private ClassBlah() { }
} }
Why have I to call this with the CallingConvention of ThisCall, its just normal "C" functions in a DLL. Why wont StdCall work?
What happens with other calling conventions is that the out parameters are NOT set, yet with ThisCall, they are set ok, or appear to be. I find
it odd.
Thanks
If you could post the original function declaration, it would help
tremendously.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl... i mean "out" oops.
ref in the same dll wrapper still gets the output but only with thiscall convention.
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:OQ**************@TK2MSFTNGP09.phx.gbl... I also have a problem with "ref" paramaters, it says they need to be assigned to before used
Yet i have them used as "ref" in dll extern calls and checked for non
NULL after yet it complains for non assignment so i use a local copy.
Isnt it smart enough to detect that its being assinged in an extern dll call as declared in DllImport?
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:#p**************@TK2MSFTNGP11.phx.gbl... Mr. Tickle,
What is the declaration of the original function? If it takes a pointer, then you should be using "ref" for the parameters, and not
out. Also, does the function take a 64-bit integer? Long in C is a 32-bit integer, where in .NET it is a 64-bit integer.
The STDCALL mechanism should work if you are using it.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:Oo**************@TK2MSFTNGP09.phx.gbl... > I am calling an unmanaged DLL like follows in a Class wrapper. > > namespace blah > { > [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", > CallingConvention=CallingConvention.ThisCall] > public static extern void blahFn(out long blah, out long blah2); > > class sealed ClassBlah > { > private ClassBlah() > { > } > > } > } > > Why have I to call this with the CallingConvention of ThisCall, its just > normal "C" functions in a DLL. Why wont StdCall work? > > What happens with other calling conventions is that the out
parameters are > NOT set, yet with ThisCall, they are set ok, or appear to be. I find it odd. > > > > Thanks > >
It would but I dont have it, its in a dll i have to call into. Not mine.
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:OB**************@TK2MSFTNGP11.phx.gbl... If you could post the original function declaration, it would help tremendously.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:e6**************@TK2MSFTNGP09.phx.gbl... i mean "out" oops.
ref in the same dll wrapper still gets the output but only with thiscall convention.
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:OQ**************@TK2MSFTNGP09.phx.gbl... I also have a problem with "ref" paramaters, it says they need to be assigned to before used
Yet i have them used as "ref" in dll extern calls and checked for non NULL after yet it complains for non assignment so i use a local copy.
Isnt it smart enough to detect that its being assinged in an extern
dll call as declared in DllImport?
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:#p**************@TK2MSFTNGP11.phx.gbl... > Mr. Tickle, > > What is the declaration of the original function? If it takes a > pointer, then you should be using "ref" for the parameters, and not out. > Also, does the function take a 64-bit integer? Long in C is a
32-bit > integer, where in .NET it is a 64-bit integer. > > The STDCALL mechanism should work if you are using it. > > Hope this helps. > > > -- > - Nicholas Paldino [.NET/C# MVP] > - ni**************@exisconsulting.com > > "Mr.Tickle" <Mr******@mrmen.com> wrote in message > news:Oo**************@TK2MSFTNGP09.phx.gbl... > > I am calling an unmanaged DLL like follows in a Class wrapper. > > > > namespace blah > > { > > [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", > > CallingConvention=CallingConvention.ThisCall] > > public static extern void blahFn(out long blah, out long blah2); > > > > class sealed ClassBlah > > { > > private ClassBlah() > > { > > } > > > > } > > } > > > > Why have I to call this with the CallingConvention of ThisCall,
its just > > normal "C" functions in a DLL. Why wont StdCall work? > > > > What happens with other calling conventions is that the out parameters are > > NOT set, yet with ThisCall, they are set ok, or appear to be. I
find it > odd. > > > > > > > > Thanks > > > > > >
typedef SOME_ID long
SOME_ID someFn(SOME_ID* someIDhere, SOME_ID* someIDhere2, SOME_ID*
someIDhere3);
something like that.
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:OB**************@TK2MSFTNGP11.phx.gbl... If you could post the original function declaration, it would help tremendously.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:e6**************@TK2MSFTNGP09.phx.gbl... i mean "out" oops.
ref in the same dll wrapper still gets the output but only with thiscall convention.
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:OQ**************@TK2MSFTNGP09.phx.gbl... I also have a problem with "ref" paramaters, it says they need to be assigned to before used
Yet i have them used as "ref" in dll extern calls and checked for non NULL after yet it complains for non assignment so i use a local copy.
Isnt it smart enough to detect that its being assinged in an extern
dll call as declared in DllImport?
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:#p**************@TK2MSFTNGP11.phx.gbl... > Mr. Tickle, > > What is the declaration of the original function? If it takes a > pointer, then you should be using "ref" for the parameters, and not out. > Also, does the function take a 64-bit integer? Long in C is a
32-bit > integer, where in .NET it is a 64-bit integer. > > The STDCALL mechanism should work if you are using it. > > Hope this helps. > > > -- > - Nicholas Paldino [.NET/C# MVP] > - ni**************@exisconsulting.com > > "Mr.Tickle" <Mr******@mrmen.com> wrote in message > news:Oo**************@TK2MSFTNGP09.phx.gbl... > > I am calling an unmanaged DLL like follows in a Class wrapper. > > > > namespace blah > > { > > [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", > > CallingConvention=CallingConvention.ThisCall] > > public static extern void blahFn(out long blah, out long blah2); > > > > class sealed ClassBlah > > { > > private ClassBlah() > > { > > } > > > > } > > } > > > > Why have I to call this with the CallingConvention of ThisCall,
its just > > normal "C" functions in a DLL. Why wont StdCall work? > > > > What happens with other calling conventions is that the out parameters are > > NOT set, yet with ThisCall, they are set ok, or appear to be. I
find it > odd. > > > > > > > > Thanks > > > > > >
Mr.Tickle,
In this case, you definitely want to use the int type, and pass it by
reference. Your declaration should look like this:
[DllImport("somedll.dll")]
public static extern int someFn(ref int someIDhere, ref int someIDhere2, ref
int someIDhere3);
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... typedef SOME_ID long
SOME_ID someFn(SOME_ID* someIDhere, SOME_ID* someIDhere2, SOME_ID* someIDhere3);
something like that.
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com>
wrote in message news:OB**************@TK2MSFTNGP11.phx.gbl... If you could post the original function declaration, it would help tremendously.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:e6**************@TK2MSFTNGP09.phx.gbl... i mean "out" oops.
ref in the same dll wrapper still gets the output but only with
thiscall convention.
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:OQ**************@TK2MSFTNGP09.phx.gbl... > I also have a problem with "ref" paramaters, it says they need to be > assigned to before used > > Yet i have them used as "ref" in dll extern calls and checked for
non NULL > after yet it complains for non assignment so i use a local copy. > > Isnt it smart enough to detect that its being assinged in an extern dll call > as declared in DllImport? > > > > > "Nicholas Paldino [.NET/C# MVP]"
<ni**************@exisconsulting.com> wrote > in message news:#p**************@TK2MSFTNGP11.phx.gbl... > > Mr. Tickle, > > > > What is the declaration of the original function? If it takes
a > > pointer, then you should be using "ref" for the parameters, and
not out. > > Also, does the function take a 64-bit integer? Long in C is a 32-bit > > integer, where in .NET it is a 64-bit integer. > > > > The STDCALL mechanism should work if you are using it. > > > > Hope this helps. > > > > > > -- > > - Nicholas Paldino [.NET/C# MVP] > > - ni**************@exisconsulting.com > > > > "Mr.Tickle" <Mr******@mrmen.com> wrote in message > > news:Oo**************@TK2MSFTNGP09.phx.gbl... > > > I am calling an unmanaged DLL like follows in a Class wrapper. > > > > > > namespace blah > > > { > > > [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", > > > CallingConvention=CallingConvention.ThisCall] > > > public static extern void blahFn(out long blah, out long
blah2); > > > > > > class sealed ClassBlah > > > { > > > private ClassBlah() > > > { > > > } > > > > > > } > > > } > > > > > > Why have I to call this with the CallingConvention of ThisCall,
its > just > > > normal "C" functions in a DLL. Why wont StdCall work? > > > > > > What happens with other calling conventions is that the out parameters > are > > > NOT set, yet with ThisCall, they are set ok, or appear to be. I find it > > odd. > > > > > > > > > > > > Thanks > > > > > > > > > > > >
But I still dont understand why Thiscall works and the others dont.
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:uv**************@TK2MSFTNGP10.phx.gbl... Mr.Tickle,
In this case, you definitely want to use the int type, and pass it by reference. Your declaration should look like this:
[DllImport("somedll.dll")] public static extern int someFn(ref int someIDhere, ref int someIDhere2,
ref int someIDhere3);
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... typedef SOME_ID long
SOME_ID someFn(SOME_ID* someIDhere, SOME_ID* someIDhere2, SOME_ID* someIDhere3);
something like that.
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:OB**************@TK2MSFTNGP11.phx.gbl... If you could post the original function declaration, it would help tremendously.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:e6**************@TK2MSFTNGP09.phx.gbl... > i mean "out" oops. > > ref in the same dll wrapper still gets the output but only with thiscall > convention. > > > "Mr.Tickle" <Mr******@mrmen.com> wrote in message > news:OQ**************@TK2MSFTNGP09.phx.gbl... > > I also have a problem with "ref" paramaters, it says they need to
be > > assigned to before used > > > > Yet i have them used as "ref" in dll extern calls and checked for non NULL > > after yet it complains for non assignment so i use a local copy. > > > > Isnt it smart enough to detect that its being assinged in an exter
n dll > call > > as declared in DllImport? > > > > > > > > > > "Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> > wrote > > in message news:#p**************@TK2MSFTNGP11.phx.gbl... > > > Mr. Tickle, > > > > > > What is the declaration of the original function? If it
takes a > > > pointer, then you should be using "ref" for the parameters, and not out. > > > Also, does the function take a 64-bit integer? Long in C is a 32-bit > > > integer, where in .NET it is a 64-bit integer. > > > > > > The STDCALL mechanism should work if you are using it. > > > > > > Hope this helps. > > > > > > > > > -- > > > - Nicholas Paldino [.NET/C# MVP] > > > - ni**************@exisconsulting.com > > > > > > "Mr.Tickle" <Mr******@mrmen.com> wrote in message > > > news:Oo**************@TK2MSFTNGP09.phx.gbl... > > > > I am calling an unmanaged DLL like follows in a Class wrapper. > > > > > > > > namespace blah > > > > { > > > > [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", > > > > CallingConvention=CallingConvention.ThisCall] > > > > public static extern void blahFn(out long blah, out long blah2); > > > > > > > > class sealed ClassBlah > > > > { > > > > private ClassBlah() > > > > { > > > > } > > > > > > > > } > > > > } > > > > > > > > Why have I to call this with the CallingConvention of
ThisCall, its > > just > > > > normal "C" functions in a DLL. Why wont StdCall work? > > > > > > > > What happens with other calling conventions is that the out parameters > > are > > > > NOT set, yet with ThisCall, they are set ok, or appear to be.
I find > it > > > odd. > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > >
Well its suppost to match up, its just something i typed in a hurry but it
is the same number of arguments in the definition and call. on teh real
code.
the dll definition would be
typedef SOMEVAL long
typedef SOME_ID long
SOME_ID someFn(SOMEVAL someVal, SOME_ID* someIDhere, SOME_ID* someIDhere2,
SOME_ID* someIDhere3);
so im calling with for example out of my memory
DllImport("somedll.dll", EntryPoint="blahFn",
CallingConvention=CallingConvention.ThisCall)]
public static extern int someFn(long someVal, ref someIDhere, ref long
someIDhere2, ref long someIDhere3);
// i know this should be int instead of long but curious why the long works
with thiscall and not the others or just not work at all.
long someVal;
long ID someID,
anotherID,
yetAnohterID,
andAnotherID;
someID = blahFn(someVal, ref anotherID, ref yetAnotherID, ref andAnotherID);
Only thiscall works, others dont, so if i understand it right I change the
definition from long to int for 32bit instead of the 64bit on the .net side,
and then i can use stdcall as normal.
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:OE**************@tk2msftngp13.phx.gbl... Because in you definition you only pass two arguments, while you need tree
(an int, and to poiters). It works while using the thiscall calling convention, because the interop
layer passes as first argument an int for the this pointer (three int's are reserved on the stack).
Willy.
"Mr.Tickle" <Mr******@mrmen.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... But I still dont understand why Thiscall works and the others dont.
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com>
wrote in message news:uv**************@TK2MSFTNGP10.phx.gbl... Mr.Tickle,
In this case, you definitely want to use the int type, and pass it
by reference. Your declaration should look like this:
[DllImport("somedll.dll")] public static extern int someFn(ref int someIDhere, ref int
someIDhere2, ref int someIDhere3);
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"Mr.Tickle" <Mr******@mrmen.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... > typedef SOME_ID long > > SOME_ID someFn(SOME_ID* someIDhere, SOME_ID* someIDhere2, SOME_ID* > someIDhere3); > > something like that. > > > "Nicholas Paldino [.NET/C# MVP]"
<ni**************@exisconsulting.com> wrote > in message news:OB**************@TK2MSFTNGP11.phx.gbl... > > If you could post the original function declaration, it would
help > > tremendously. > > > > > > -- > > - Nicholas Paldino [.NET/C# MVP] > > - ni**************@exisconsulting.com > > > > "Mr.Tickle" <Mr******@mrmen.com> wrote in message > > news:e6**************@TK2MSFTNGP09.phx.gbl... > > > i mean "out" oops. > > > > > > ref in the same dll wrapper still gets the output but only with thiscall > > > convention. > > > > > > > > > "Mr.Tickle" <Mr******@mrmen.com> wrote in message > > > news:OQ**************@TK2MSFTNGP09.phx.gbl... > > > > I also have a problem with "ref" paramaters, it says they need
to be > > > > assigned to before used > > > > > > > > Yet i have them used as "ref" in dll extern calls and checked
for non > > NULL > > > > after yet it complains for non assignment so i use a local
copy. > > > > > > > > Isnt it smart enough to detect that its being assinged in an
exter n > dll > > > call > > > > as declared in DllImport? > > > > > > > > > > > > > > > > > > > > "Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> > > > wrote > > > > in message news:#p**************@TK2MSFTNGP11.phx.gbl... > > > > > Mr. Tickle, > > > > > > > > > > What is the declaration of the original function? If it takes a > > > > > pointer, then you should be using "ref" for the parameters,
and not > > out. > > > > > Also, does the function take a 64-bit integer? Long in C is
a > 32-bit > > > > > integer, where in .NET it is a 64-bit integer. > > > > > > > > > > The STDCALL mechanism should work if you are using it. > > > > > > > > > > Hope this helps. > > > > > > > > > > > > > > > -- > > > > > - Nicholas Paldino [.NET/C# MVP] > > > > > - ni**************@exisconsulting.com > > > > > > > > > > "Mr.Tickle" <Mr******@mrmen.com> wrote in message > > > > > news:Oo**************@TK2MSFTNGP09.phx.gbl... > > > > > > I am calling an unmanaged DLL like follows in a Class
wrapper. > > > > > > > > > > > > namespace blah > > > > > > { > > > > > > [DllImport("DLLName.DLL", EntryPoint="BlahEntryPoint", > > > > > > CallingConvention=CallingConvention.ThisCall] > > > > > > public static extern void blahFn(out long blah, out long blah2); > > > > > > > > > > > > class sealed ClassBlah > > > > > > { > > > > > > private ClassBlah() > > > > > > { > > > > > > } > > > > > > > > > > > > } > > > > > > } > > > > > > > > > > > > Why have I to call this with the CallingConvention of ThisCall, > its > > > > just > > > > > > normal "C" functions in a DLL. Why wont StdCall work? > > > > > > > > > > > > What happens with other calling conventions is that the
out > > parameters > > > > are > > > > > > NOT set, yet with ThisCall, they are set ok, or appear to
be. I > find > > > it > > > > > odd. > > > > > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mr.Tickle |
last post by:
I am calling an unmanaged DLL like follows in a Class wrapper.
namespace blah
{
public static extern void blahFn(out long blah, out long blah2);
class sealed ClassBlah
{
private...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |