dim s_err as stringbuilder
dim xx(6) as double
dim ret_flag as integer
' This is a function to call an unmanaged C-style library function.
' The lib function fills an array of 6 doubles or error string.
Declare Auto Function calc Lib "calc32.dll" Alias "calc32.dll"( ByRef xx()
As Double, ByVal serr As System.Text.StringBuilder) As Integer
' Using the unmanaged function:
ret_flag = swe_calc(tjd_et, planet, iflag, xx(6), serr)
If I take out the 6 in the above line, I get error "number of indices is
less than the number of dimensions in the indexed array."
If I put it in, or put a zero in, like xx(0) or xx(6), I get the error
"value of type double cannot be converted to '1 dimensional array of
double'"
What is wrong here? TIA
--
Patrick Sullivan, AA-BA, BA-IT 4 4833
dim s_err as stringbuilder
dim xx(6) as double
dim ret_flag as integer
' This is a function to call an unmanaged C-style library function.
' The lib function fills an array of 6 doubles or error string.
Declare Auto Function calc Lib "calc32.dll" Alias "calc32.dll"( ByRef xx()
As Double, ByVal serr As System.Text.StringBuilder) As Integer
' Using the unmanaged function:
ret_flag = swe_calc(xx(6), serr)
If I take out the 6 in the above line, I get error "number of indices is
less than the number of dimensions in the indexed array."
If I put it in, or put a zero in, like xx(0) or xx(6), I get the error
"value of type double cannot be converted to '1 dimensional array of
double'"
What is wrong here? TIA
Patrick Sullivan wrote: dim s_err as stringbuilder dim xx(6) as double dim ret_flag as integer
' This is a function to call an unmanaged C-style library function. ' The lib function fills an array of 6 doubles or error string.
Declare Auto Function calc Lib "calc32.dll" Alias "calc32.dll"( ByRef xx() As Double, ByVal serr As System.Text.StringBuilder) As Integer
' Using the unmanaged function:
ret_flag = swe_calc(xx(6), serr)
Copy-and-pasting code is a much more reliable way of showing us your
code. Note that the Declare calls the function 'calc' but you call it
as 'swe_calc'. If we have to guess what you mean, it will take us
longer to help you. If I take out the 6 in the above line, I get error "number of indices is less than the number of dimensions in the indexed array."
If I put it in, or put a zero in, like xx(0) or xx(6), I get the error "value of type double cannot be converted to '1 dimensional array of double'"
Try
ret_flag = calc(xx, serr)
The function wants an array: it is xx - not xx(0) or xx(6) or xx() -
that is an array.
Also, xx should be initialised to an empty array before calling the
DLL, otherwise there will be nowehere to put the results:
xx = New Double(6) {}
Also also, all I have fixed is the syntax: I don't know enough about
calling unmanaged code to be able to say that this will definitely do
what you want.
--
Larry Lard
Replies to group please
Thanks Larry. You figured out what I wanted to know, I think. Interop is
kind of confusing. It took me quite a while to get the s_err to pass
compiling.
--
Patrick Sullivan, AA-BA, BA-IT
"Larry Lard" <la*******@hotmail.com> wrote in message
news:11*********************@g10g2000cwb.googlegro ups.com... Patrick Sullivan wrote: dim s_err as stringbuilder dim xx(6) as double dim ret_flag as integer
' This is a function to call an unmanaged C-style library function. ' The lib function fills an array of 6 doubles or error string.
Declare Auto Function calc Lib "calc32.dll" Alias "calc32.dll"( ByRef
xx() As Double, ByVal serr As System.Text.StringBuilder) As Integer
' Using the unmanaged function:
ret_flag = swe_calc(xx(6), serr)
Copy-and-pasting code is a much more reliable way of showing us your code. Note that the Declare calls the function 'calc' but you call it as 'swe_calc'. If we have to guess what you mean, it will take us longer to help you.
If I take out the 6 in the above line, I get error "number of indices is less than the number of dimensions in the indexed array."
If I put it in, or put a zero in, like xx(0) or xx(6), I get the error "value of type double cannot be converted to '1 dimensional array of double'"
Try
ret_flag = calc(xx, serr)
The function wants an array: it is xx - not xx(0) or xx(6) or xx() - that is an array.
Also, xx should be initialised to an empty array before calling the DLL, otherwise there will be nowehere to put the results:
xx = New Double(6) {}
Also also, all I have fixed is the syntax: I don't know enough about calling unmanaged code to be able to say that this will definitely do what you want.
-- Larry Lard Replies to group please
You are declaring an array of 7 doubles. To declare an array of 6
doubles, you have to do like this:
dim xx(5) as double
Patrick Sullivan wrote: dim s_err as stringbuilder dim xx(6) as double dim ret_flag as integer
' This is a function to call an unmanaged C-style library function. ' The lib function fills an array of 6 doubles or error string.
Declare Auto Function calc Lib "calc32.dll" Alias "calc32.dll"( ByRef xx() As Double, ByVal serr As System.Text.StringBuilder) As Integer
' Using the unmanaged function:
ret_flag = swe_calc(xx(6), serr)
If I take out the 6 in the above line, I get error "number of indices is less than the number of dimensions in the indexed array."
If I put it in, or put a zero in, like xx(0) or xx(6), I get the error "value of type double cannot be converted to '1 dimensional array of double'"
What is wrong here? TIA This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marc Schellens |
last post by:
Following the NumPy documentation, I took over some C code,
but run into an error.
Does anybody have a suggestion?
Thanks,
marc
gdlpython.cpp:225: `PyArray_Type' undeclared (first use this...
|
by: Jason |
last post by:
Hi,
I need a way to use random numbers in c++. In my c++ project, when using
the mingw compiler I used a mersenne twister that is publicly available and
this did its job well. Now I have...
|
by: JRoe |
last post by:
Hello,
I am beside myself with this problem.
I need to access unmanged C++ code in a C# environment. I have created
a managed C++ wrapper that wraps the unmanaged class.
When I call the...
|
by: Sugan |
last post by:
Hi All,
I have a peculiar kind of issue after converting VC and VB code from
Visual studio 6.0 to Visual Studio 2005.
We have the business logic in the VC code which uses the ATL framework...
|
by: Sugan |
last post by:
Hi All,
I have a peculiar kind of issue after converting VC and VB code from
Visual studio 6.0 to Visual Studio 2005.
We have the business logic in the VC code which uses the ATL framework...
|
by: =?Utf-8?B?VG9ub2ZpdA==?= |
last post by:
I've got the following umanaged code that I need to handle in C# code. The
data I read comes from an external device, by Read(ID, &data, REGLEN);
How should the code look for the structs in ...
|
by: dileepd |
last post by:
Hi Every one,
Could you please let me know if you have any clue about following
things.
1. Whether type bool acts like a kind of signed int type in g++ on
solaris 9(a/c to my invetsigation it...
|
by: Mohamed Mansour |
last post by:
Hey there, this will be somewhat a long post, but any response is
appreciated!
I have done many PInvoke in the past from C++ to C#, but I did PInvoke
within C# not C++/CLI.
Can someone explain...
|
by: dprjessie |
last post by:
Hello,
I am a Web programmer and I'm working on my first desktop application as a favor for a friend. I'm sure I have a stupid error here, but there is no error being thrown so I can't figure out...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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: 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: 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,...
|
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...
|
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...
| |