Hi, I cannot find the correct attributes to marshal the following
unmanaged function signature:
void WINAPI GeomVec2AngleD(const Vector2RecD& v1, const Vector2RecD& v2,
double& angle)
I thought this would work:
[DllImport("xform400.dll")]
public static extern void GeomVec2AngleD([In] Point2D v1, [In] Point2D
v2, [In, Out] double angle);
Point2D's layout maps directly to Vector2RecD, there is no problem
there, the problem is, as soon as the C++ code attempts to write to
angle it throws a System.AccessViolationException.
I tried a few more possible solutions but I cannot find the correct one.
Thanks 2 2693
jonpb,
You can not use references through the P/Invoke layer.
Rather, you will have to expose a function which takes pointers instead,
and marshal that function. Then, your function would just make the call to
the original function.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"jonpb" <no****@nospam.comwrote in message
news:eP*************@TK2MSFTNGP05.phx.gbl...
Hi, I cannot find the correct attributes to marshal the following
unmanaged function signature:
void WINAPI GeomVec2AngleD(const Vector2RecD& v1, const Vector2RecD& v2,
double& angle)
I thought this would work:
[DllImport("xform400.dll")]
public static extern void GeomVec2AngleD([In] Point2D v1, [In] Point2D v2,
[In, Out] double angle);
Point2D's layout maps directly to Vector2RecD, there is no problem there,
the problem is, as soon as the C++ code attempts to write to angle it
throws a System.AccessViolationException.
I tried a few more possible solutions but I cannot find the correct one.
Thanks
"jonpb" <no****@nospam.comwrote in message
news:eP*************@TK2MSFTNGP05.phx.gbl...
Hi, I cannot find the correct attributes to marshal the following
unmanaged function signature:
void WINAPI GeomVec2AngleD(const Vector2RecD& v1, const Vector2RecD& v2,
double& angle)
I thought this would work:
[DllImport("xform400.dll")]
public static extern void GeomVec2AngleD([In] Point2D v1, [In] Point2D v2,
[In, Out] double angle);
Point2D's layout maps directly to Vector2RecD, there is no problem there,
the problem is, as soon as the C++ code attempts to write to angle it
throws a System.AccessViolationException.
I tried a few more possible solutions but I cannot find the correct one.
You should use "ref" on the angle parameter.
>
Thanks
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Angel |
last post by:
Hi again,
I'm trying to call functions from a proprietary DLL but it's turned out to
be more difficult than I thought.
I have this W32.DLL which was written in C by USPS. They don't provide the...
|
by: Ken Allen |
last post by:
The documentation is not clear on the exact behaviour of the
Marshal.PtrToStructure method and whether it copies the contents of the
IntPtr region to a new managed object or whether it creates the...
|
by: John |
last post by:
public const int FRAME_LENGTH=144;
public class FRAME_T
{
public byte Block = new byte; }
public void MyDataHandler(IntPtr appContext, IntPtr data)
FRAME_T frame = new FRAME_T();...
|
by: Tom |
last post by:
I think I'm still a little rough on the principle and understanding of
Marshal by value and Marshal by reference after reading various materials.
my understanding of Marshal by value is that the...
|
by: ALI-R |
last post by:
Is there somebody who can guid me to an example of marshal by value
implementation of remote object?.
I have read a lot of docs but they are mostly focused on marshal by ref and
there is no...
|
by: SB |
last post by:
I feel dumb to ask because I bet this is a simple question...
Looking at the code below, can someone please explain why I get two
different values in my Marshal.SizeOf calls (see the commented...
|
by: dhornyak |
last post by:
I have been banging my head against the wall for a while now, and can't
seem to id the problem. I've been through a ton of posts and the code
doesn't seem any different. Can anybody see it?
When...
|
by: Just Me |
last post by:
The following almost works.
The problem is Marshal.PtrToStringAuto seems to terminate at the first null
so I don't get the full string.
Any suggestions on how to fix this?
Or how to improve the...
|
by: Mike |
last post by:
Hi,
The example below shows that result of a marshaled data structure is
nothing but a string
>>> data = {2:'two', 3:'three'}
>>> import marshal
>>> bytes = marshal.dumps(data)
>>>...
|
by: cleanrabbit |
last post by:
Hello!
I hate having to do this, because im almost certain there is someone in the world that has come across this problem and i just havent found their solution yet, so i do appologise if this...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |