Issues with Arrays and DLLs

joeblow7

New Member
Joined
Jun 27, 2017
Messages
33
Office Version
  1. 365
I'm having a problem with getting arrays populated with functions that are called from a dll. A quick example is:
Code:
Private Declare Function MHL200_GetDLLVersion Lib "dll path" (ByRef pulDllVersion() As Long) As MHL200_ErrorEnum

Then, I call it as such:
Code:
Dim ulaVersion(2) As Long  
ulMHL200Error = MHL200_GetDLLVersion(ulaVersion)

And then try to display the array like so:

Code:
MsgBox "dll version  " & ulaversion(0) & "." & ulaversion(1) 
Cells(23, 2) = ulaversion(0)

Each element of the array is 0, regardless of what I do, and it does this for any time I try and use an array. I can run it in C++ and it will print the correct values, so I know it isn't the dll. Is there something special needed for using arrays?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
The issue with that is I'm not getting any errors and can use other functions just fine, as long as they aren't an array. The header file for the dll also already includes "extern "C"", which should prevent the names from getting mangled.
 
Upvote 0
The issue with that is I'm not getting any errors and can use other functions just fine, as long as they aren't an array. The header file for the dll also already includes "extern "C"", which should prevent the names from getting mangled.

Hmm...I'm not sure. I've never tried to use a DLL other than window DLLs
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top