Click here to Skip to main content
15,900,108 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralI want to lock the Access database (VB.6) Pin
Nazila Naderi10-Sep-03 15:40
Nazila Naderi10-Sep-03 15:40 
GeneralRe: I want to lock the Access database (VB.6) Pin
Meysam Khayatan11-Sep-03 12:03
Meysam Khayatan11-Sep-03 12:03 
GeneralEasy VBScript question about the file pointer Pin
monkeyman9910-Sep-03 12:10
sussmonkeyman9910-Sep-03 12:10 
GeneralRe: Easy VBScript question about the file pointer Pin
NetPointerIN11-Sep-03 9:42
NetPointerIN11-Sep-03 9:42 
GeneralBasic DataGrid Navigation. Pin
Steverty10-Sep-03 10:32
Steverty10-Sep-03 10:32 
Generalconverting vb double to vc double Pin
Member 57284910-Sep-03 8:04
Member 57284910-Sep-03 8:04 
GeneralRe: converting vb double to vc double Pin
Nic Rowan10-Sep-03 23:44
Nic Rowan10-Sep-03 23:44 
GeneralRe: converting vb double to vc double Pin
Member 57284911-Sep-03 4:07
Member 57284911-Sep-03 4:07 
From what I understand the structure byte alignments for vb vs vc are 4 bytes and 8 bytes respectively. VB dynamically decides the byte alignment which is usually 4 but it can change it to optimize class structures.

The reason I'm asking this is I'm passing a structure with a double array inside it from VB to a VC dll. When I change the value of the double array inside the dll, it doesn't change the vb value. I'm passing by reference.

Here is my vb code:
<br />
Public Type assetvar<br />
    cutoff_prin_bal(400) As Double<br />
End Type<br />
<br />
Public Type collateralvar<br />
    subissue(100) As Integer<br />
    asset As assetvar<br />
End Type<br />
<br />
Public Declare Function test Lib "PSAEngine.dll" Alias "_test@8" _<br />
    (ByVal j As Integer, ByRef collateral As collateralvar) As Double<br />


The vc dll is:
<br />
struct assetvar<br />
{<br />
	double cutoff_prin_bal[400];<br />
};<br />
<br />
struct collateralvar<br />
{<br />
	int subissue[100];<br />
	struct assetvar asset;<br />
};<br />
<br />
__declspec( dllexport ) double test(int j, struct collateralvar *collateral);<br />


Here is what I am doing inside the dll function:


<br />
__declspec( dllexport ) double test(int j, struct collateralvar *collateral)<br />
{<br />
	collateral->asset.cutoff_prin_bal[j]=14;<br />
<br />
	return(1);<br />
}<br />



from VB I'm calling the dll this way:


<br />
    dim x as double<br />
    collateral.asset.cutoff_prin_bal(0) = 423149.74<br />
    x = test(0, collateral)<br />



I still get 423149.74 instead of 14.0. Therefore they are not the same thing.
GeneralRe: converting vb double to vc double Pin
Nic Rowan11-Sep-03 8:06
Nic Rowan11-Sep-03 8:06 
GeneralConvert from VS.Net 2003 to VS.Net Pin
Orcrist10-Sep-03 6:12
Orcrist10-Sep-03 6:12 
GeneralDeleteCommand problem.. Pin
GJul10-Sep-03 4:48
GJul10-Sep-03 4:48 
Generalall about exceptions Pin
fume9-Sep-03 22:09
fume9-Sep-03 22:09 
GeneralRe: all about exceptions Pin
SimonS9-Sep-03 22:11
SimonS9-Sep-03 22:11 
GeneralRe: all about exceptions Pin
fume10-Sep-03 14:08
fume10-Sep-03 14:08 
GeneralRe: all about exceptions Pin
fume10-Sep-03 14:17
fume10-Sep-03 14:17 
Generalerror bad dll calling convention Pin
Member 5728499-Sep-03 12:15
Member 5728499-Sep-03 12:15 
GeneralRe: error bad dll calling convention Pin
Hesham Amin9-Sep-03 21:43
Hesham Amin9-Sep-03 21:43 
GeneralRe: error bad dll calling convention Pin
Member 57284910-Sep-03 4:22
Member 57284910-Sep-03 4:22 
GeneralRe: error bad dll calling convention Pin
Member 57284910-Sep-03 7:22
Member 57284910-Sep-03 7:22 
GeneralNewbie to VB need some advice please Pin
Flack9-Sep-03 7:04
Flack9-Sep-03 7:04 
GeneralRe: Newbie to VB need some advice please Pin
Ray Cassick9-Sep-03 7:45
Ray Cassick9-Sep-03 7:45 
GeneralRe: Newbie to VB need some advice please Pin
NetPointerIN11-Sep-03 9:51
NetPointerIN11-Sep-03 9:51 
GeneralRe: Newbie to VB need some advice please Pin
Ray Cassick11-Sep-03 9:56
Ray Cassick11-Sep-03 9:56 
GeneralDeploy .Net Application using Access Database Pin
zengfu9-Sep-03 4:54
zengfu9-Sep-03 4:54 
GeneralRe: Deploy .Net Application using Access Database Pin
SimonS9-Sep-03 22:09
SimonS9-Sep-03 22:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.