I have a dll library for which the call in .net is as follows. - Declare Function CopyDesign Lib "OS50.DLL" _
-
(ByVal I_RPath As String, ByVal I_Flags As Integer, ByVal I_Typ As String, _
-
ByVal I_CC As Integer, ByVal I_Ref As String, ByVal I_Q As Double, _
-
ByVal I_T0 As Double, ByVal I_TC As Double, ByVal I_TS As Double, _
-
ByVal I_TL As Double, ByVal I_TM As Long, ByVal I_TLC As Double, _
-
ByVal I_TOC As Integer, ByVal I_TOL As Double, ByVal I_TN As Double, _
-
ByVal I_OP As Integer, ByVal I_SP As Single, ByVal I_CR As Single, _
-
ByVal O_T1 As String, ByRef O_SzT1 As Integer, _
-
ByVal O_T2 As String, ByRef O_SzT2 As Integer, _
-
ByRef DesignData As TDesignData, _
-
ByRef O_Hint1 As Integer, ByRef O_Hint2 As Integer, _
-
ByVal O_Err As String, ByRef O_SzErr As Integer) As Integer
-
-
I have written the following call, but it won't work.
-
public struct TDesignData
-
{
-
public int O_OP1;
-
public int O_OP2;
-
public double O_Q1;
-
public double O_Q2;
-
public double O_QU1;
-
public double O_QU2;
-
public double O_QN1;
-
public double O_QN2;
-
public double O_QC1;
-
public double O_QC2;
-
public double O_QH1;
-
public double O_QH2;
-
public double O_P1;
-
public double O_P2;
-
public double O_E1;
-
public double O_E2;
-
public double O_EN1;
-
public double O_EN2;
-
public double O_VG1;
-
public double O_VG2;
-
public float O_MT1;
-
public float O_MT2;
-
public double O_M1;
-
public double O_M2;
-
public double O_ME1;
-
public double O_ME2;
-
public double O_QS1;
-
public double O_QS2;
-
public double O_TE1;
-
public double O_TE2;
-
public double O_PE1;
-
public double O_PE2;
-
public double O_TL1;
-
public double O_TL2;
-
public double O_TH1;
-
public double O_TH2;
-
public double O_QA1;
-
public double O_QA2;
-
public double O_VOL1;
-
public double O_VOL2;
-
public double O_TOL1;
-
public double O_TOL2;
-
public double O_TJ1;
-
public double O_TJ2;
-
public double O_PJ1;
-
public double O_PJ2;
-
}
-
-
[DllImport("OS50.DLL",
-
CallingConvention = CallingConvention.StdCall)]
-
-
-
public static extern int CopyDesign(
-
string I_RPath,
-
int I_Flags,
-
string I_Typ,
-
int I_CC,
-
string I_Ref,
-
double I_Q,
-
double I_T0,
-
double I_TC,
-
double I_TS,
-
double I_TL,
-
long I_TM,
-
double I_TLC,
-
int I_TOC,
-
double I_TOL,
-
double I_TN,
-
int I_OP,
-
float I_SP,
-
float I_CR,
-
string O_T1,
-
int O_SzT1,
-
string O_T2,
-
int O_SzT2,
-
TDesignData DesignData,
-
int O_Hint1,
-
int O_Hint2,
-
string O_Err,
-
int O_SzErr);
-
-
-
-
public void Run()
-
{
-
-
-
I_RPath = RefFiles;
-
-
I_Flags = (CalcWithIPUnits + BIM_Mode);
-
I_Flags = (I_Flags + CalcWithSuperheat);
-
I_Flags = (I_Flags + CalcWithSubcooling);
-
I_CC = 0;
-
I_Ref = "R717";
-
I_TS = 1.8;
-
I_TL = 0;
-
I_TM = 0;
-
I_TLC = 0;
-
I_TOC = 0;
-
I_TOL = 175;
-
I_TN = 0;
-
I_OP = 1;
-
I_SP = 3500;
-
I_CR = 100;
-
I_Typ="OSNA5351";
-
I_T0=-30;
-
I_TC=75;
-
-
errorMsgNum = CopyDesign(I_RPath,
-
I_Flags,
-
I_Typ,
-
I_CC,
-
I_Ref,
-
I_Q,
-
I_T0,
-
I_TC,
-
I_TS,
-
I_TL,
-
I_TM,
-
I_TLC,
-
I_TOC,
-
I_TOL,
-
I_TN,
-
I_OP,
-
I_SP,
-
I_CR,
-
O_T1,
-
O_SzT1,
-
O_T2,
-
O_SzT2,
-
DesignData,
-
O_Hint1,
-
O_Hint2,
-
O_Err,
-
O_SzErr);
-
-
Console.WriteLine(DesignData.O_Q1);
-
Console.WriteLine(DesignData.O_M1);
-
Console.WriteLine(DesignData.O_P1);
-
Console.WriteLine(DesignData.O_VOL1);
-
Console.WriteLine(DesignData.O_TOL1);
It gives me Access Violation Exception. Attended to read or write protected memory. I am new to C# and have been trying to resolve this in the last couple days. Any help will be appreciated.
0 1163 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Donald L. Dietmeyer |
last post by:
I was given a libxx.so that was probably written in Delphi.
I need to wrap it so that I can call the functions/procedures
of the library from Python. I tried the usual extension
technique...
|
by: windozbloz |
last post by:
Bye Bye Billy Bob...
I'm back with one more question, then I'll chill. I have scoured the news
and net for info about Borlands KYLIX 3 and have found little technical
info about it. Their...
|
by: ARTMIC |
last post by:
Hello,
could someone please help me out, i'm trying to call a Delphi 6.0 custom DLL
from inside of a C# windows project. what am i doing wrong? i use the
following declaration:
public class...
|
by: Prabhat |
last post by:
Hello ALL,
I have ASP pages that calls some ISAPI dll that created using Delphi for
generating reports. The report page opens fine for 1st time when invoked but
next time i get error like "Name...
|
by: Bart Roozendaal |
last post by:
I am using a C# assembly in Delphi.Win32 using the com interop services.
This works fine, but I am looking for a way to debug the C# assembly. When
using a Delphi program as a host for the...
|
by: jewalsh2k |
last post by:
Hi,
I have a delphi dll which I am trying to call from C# but something
isn't working, I get an SEHException thrown by the dll but I don't get
enough info to debug it. I can't change the dll...
|
by: Ryanivanka |
last post by:
hi,
I am using a delphi DLL in vc++,static linked with ".h"and "lib".
the export functions in DLL are "__stdcall",but the function doesn't
work well,it often returns some weird values.
when I add...
|
by: kelvin.koogan |
last post by:
How can I call a function in a Delphi DLL from C++/CLI?
The Delphi function is declared as follows:
function Func1(IsDsb: Boolean; FirstStr, SecondStr : String): String;
I've tried
...
|
by: Peted |
last post by:
Hi
i realise this is an esoteric subject, but im hoping someone can help
me
im working with a legacy application that was originaly developed in
delphi 7, and inaddition to this the...
|
by: BornTOCode |
last post by:
Hello,
I am attempting to call a (Delphi) win32 DLL from a Delphi.Net webservice. I am using a slightly modified version of the hello world webservice that comes with Delphi 2006.
The DLL...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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: 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:
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...
|
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...
| |