473,480 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VB.Net and c++ dll

27 New Member
Hi, I'm trying to call a c++ dll from vb.net. My problem is in trying to figure out how to rewrite the parameters from c++ to vb. The original function in the dll is:

void WINAPI FindCBondPrice(int& issueDays, int& settleDays, int& exerciseDays, int& convProt,
int& couponchoice, int& couponfrequency,
int& exercisechoice, int& methodchoice, int& yieldchoice,
int& spreadchoice, int& volatilitychoice,
int& dividendchoice, int& divfrequency, int& schedulechoice,
int& divprotchoice, double& dptrigger, double& underlying, double *volatility,
double& divYield, int& dLen, int *dDays, double *dPrice, double& redemption,
double *riskFree, double& couponrate, double& conversionRatio,
double* convertibleSpread, double& equitySpread, double& stockRecovery,
double& bondRecovery, int& cLen, int *cDays, double *cPrice, double *cTrig,
int& pLen, int *pDays, double *pPrice, double *Results, char *errors,
double *time, bool printresults)

I tried rewriting this as:

Private Declare Sub FindCBondPrice _
Lib "ConvEngine.dll" _
(ByVal issueDays As Integer, ByVal settleDays As Integer, ByVal exerciseDays As Integer, _
ByVal convProt As Integer, ByVal couponchoice As Integer, ByVal couponfrequency As Integer, _
ByVal exercisechoice As Integer, ByVal methodchoice As Integer, ByVal yieldchoice As Integer, _
ByVal spreadchoice As Integer, ByVal volatilitychoice As Integer, ByVal dividendchoice As Integer, _
ByVal divfrequency As Integer, ByVal schedulechoice As Integer, ByVal divprotchoice As Integer, _
ByVal dptrigger As Double, ByVal underlying As Double, ByRef volatility() As Double, _
ByVal divYield As Double, ByVal dLen As Integer, ByRef dDays() As Integer, ByRef dPrice() As Double, _
ByVal redemption As Double, ByRef riskFree() As Double, ByVal couponrate As Double, _
ByVal conversionRatio As Double, ByRef convertibleSpread() As Double, ByVal equitySpread As Double, _
ByVal stockRecovery As Double, ByVal bondRecovery As Double, ByVal cLen As Integer, _
ByRef cDays() As Integer, ByRef cPrice() As Double, ByRef cTrig() As Double, ByVal pLen As Integer, _
ByRef pDays() As Integer, ByRef pPrice() As Double, ByRef myresults() As Double, ByVal errors As String, _
ByVal time As Double, ByRef printresults As Boolean)

The error message I get is:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at Convert_Database.ModelForm.FindCBondPrice(Int32 issueDays, Int32 settleDays, Int32 exerciseDays, Int32 convProt, Int32 couponchoice, Int32 couponfrequency, Int32 exercisechoice, Int32 methodchoice, Int32 yieldchoice, Int32 spreadchoice, Int32 volatilitychoice, Int32 dividendchoice, Int32 divfrequency, Int32 schedulechoice, Int32 divprotchoice, Double dptrigger, Double underlying, Double[]& volatility, Double divYield, Int32 dLen, Int32[]& dDays, Double[]& dPrice, Double redemption, Double[]& riskFree, Double couponrate, Double conversionRatio, Double[]& convertibleSpread, Double equitySpread, Double stockRecovery, Double bondRecovery, Int32 cLen, Int32[]& cDays, Double[]& cPrice, Double[]& cTrig, Int32 pLen, Int32[]& pDays, Double[]& pPrice, Double[]& myresults, String& errors, Double time, Boolean& printresults)

at Convert_Database.ModelForm.RunModel_Click(Object sender, EventArgs e) in C:\Development\Convert Database\Convert Database\ModelForm.vb:line 982

What am I doing wrong? Thanks in advance.

John
Aug 1 '07 #1
0 1090

Sign in to post your reply or Sign up for a free account.

Similar topics

3
11162
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
5764
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
22950
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
8424
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
8520
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
18206
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
6767
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
31332
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
23520
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
7052
Oralloy
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,...
0
7092
jinu1996
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...
1
6744
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...
0
6981
tracyyun
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...
1
4790
isladogs
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...
0
3000
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2989
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
188
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.