Ask Your Question
1

How can I call a DLL function with an array as an argument? [closed]

asked 2012-12-10 20:36:57 +0100

Alexander gravatar image

updated 2015-10-23 14:16:01 +0100

Alex Kemp gravatar image

Hi all.

I need to call DLL function with an array of long numbers as an argument.

I define this in C++ code as follows:

'#define EXPORT extern "C" __declspec(dllexport)
EXPORT void MyFunc(long *lArgs) {
...
}

How I could call this function from OO Basic?
I do this on Excel VBA very simple:

Public Declare Sub MyFucnd Lib "MyLib.dll" (ByRef lArgs As Long)
  Dim MyArray(3) As Long
  MyArray(0) = Value0
  MyArray(1) = Value1
  MyArray(2) = Value2
  MyFunc MyArray(0)

This code is working on Excel, but not work on OO Basic :(

What is mistake? What should I do?

Thanks.

Alex.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-10-23 14:16:15.850043

Comments

Try this: (try #1) Public Declare Function MyFucnd Lib "MyLib.dll" (ByRef lArgs As Long) as Long if it not work, try change the argument so the declaration appear like this: (try #2) Public Declare Function MyFucnd Lib "MyLib.dll" ( lArgs ) as Long

Paijo gravatar imagePaijo ( 2013-06-12 12:29:36 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2013-03-10 05:21:13 +0100

qubit gravatar image

Hi @Alexander,

Are you getting any kind of error message when you to run your code?

Here's a note in the Online Help regarding calling-into DLLs:

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-12-10 20:36:57 +0100

Seen: 1,271 times

Last updated: Mar 10 '13