Calling external DLL from Power Language with array passed by reference

Questions about MultiCharts and user contributed studies.
gero65
Posts: 10
Joined: 12 Sep 2019
Has thanked: 4 times
Been thanked: 1 time

Calling external DLL from Power Language with array passed by reference

Postby gero65 » 12 Sep 2019

I need clarification about external DLL calling from inside Power Language.
The DLL is not crated by myself but is from a third-party software house.
The DLL is correctly recognized and a simple function is working.
However, I need to pass an array by reference in a function call and after many attempts I was unable to do this.

I am calling some functions inside a DLL with this test code:

Code: Select all

Vars: JulianDayUT(0), ret_flag(0), serr("");
Array: LongPos[5](0);[ // How to declare it?
DefineDLLFunc: "C:\Swiss Ephemeris\ephe\swedll64.dll",Double,"swe_julday",Long,Long,Long,Double,Long;
//I call it with this line.
JuliandayUT = swe_julday(2019, 9, 3, 1200, 1);
print("JulianDayUT= ",JulianDayUT);
// This is working fine and Julian day number is printed every bar
// The following function expects to receive the pointer to an array of 6 elements that will be returned with the result of the function.
DefineDLLFunc: "C:\Swiss Ephemeris\ephe\swedll64.dll",Long,"swe_calc",Double,Long,Long,Double,String;
ret_flag = swe_calc(JuliandayUT, 0, 274, LongPos[0],serr);
{This is not working. The function needs that the array LongPos is passed By Refrence, because it will return result to the mail Power Language code by changing the values of the array.}
Using standard array the compiler gives no error but I get an exception error during execution. same with array declared as dynamic.
Using the declaration NumericArrayref, the compiler gives an error since the code is declared as a strategy, not a function. Maybe I need to call the DLL using a function instead of a strategy?

My question is: how to declare the array LongPos to be able to pass it by reference to the function swe_calc?

Thank you in advance for your help!
Paolo
Last edited by gero65 on 16 Sep 2019, edited 5 times in total.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Calling external DLL from Power Language with array passed by reference

Postby TJ » 12 Sep 2019

See post #1 & #2
viewtopic.php?t=11713

gero65
Posts: 10
Joined: 12 Sep 2019
Has thanked: 4 times
Been thanked: 1 time

Re: Calling external DLL from Power Language with array passed by reference

Postby gero65 » 12 Sep 2019

Done, thanks TJ

Meecc
Posts: 50
Joined: 23 Jun 2011
Has thanked: 22 times
Been thanked: 7 times

Re: Calling external DLL from Power Language with array passed by reference

Postby Meecc » 13 Sep 2019

Hello
Array declaration should be in the form of
array: ArrayName[size](initialValue) ;
sth like
array: LongPos[5](0);

gero65
Posts: 10
Joined: 12 Sep 2019
Has thanked: 4 times
Been thanked: 1 time

Re: Calling external DLL from Power Language with array passed by reference

Postby gero65 » 13 Sep 2019

Hello
Array declaration should be in the form of
array: ArrayName[size](initialValue) ;
sth like
array: LongPos[5](0);
Thanks Meecc,

Yes the declaration of the array is incorrect in the cose I posted (corrected now), but this doesn't solve my problem.
The question is: how I should declare the array LongPos to be able to pass it by reference to the function swe_calc?

Meecc
Posts: 50
Joined: 23 Jun 2011
Has thanked: 22 times
Been thanked: 7 times

Re: Calling external DLL from Power Language with array passed by reference

Postby Meecc » 13 Sep 2019

Hello
my guess is to try
assigning LongPos[0] to a var and then pass the var to the fn call.

var: myvar(0);
myvar = LongPos[0];

then change from
ret_flag = swe_calc(JuliandayUT, 0, 274, LongPos[0],serr);
to
ret_flag = swe_calc(JuliandayUT, 0, 274, myvar ,serr);
as the fn template is looking for a double variable , a double myvar should do.

then assign myvar back to Array for uses
LongPos[0] = myvar ;

gero65
Posts: 10
Joined: 12 Sep 2019
Has thanked: 4 times
Been thanked: 1 time

Re: Calling external DLL from Power Language with array passed by reference

Postby gero65 » 14 Sep 2019

Hello Meecc, thanks for your reply.

I tested what you suggested but got a memory exception:

<<EXCEPTION>>
Code: 0xFFFFFFFFC0000005 ( -1073741819 )
Continuable: 0x0000000000000000 ( 0 )
Description: L'istruzione a 0x%p ha fatto riferimento alla memoria a 0x%p. La memoria non poteva essere %s.
ErrorCode: 0xFFFFFFFFC0000005 ( -1073741819 )
ExceptionType: 0x0000000000000000 ( 0 )
Module: c:\swiss ephemeris\ephe\swedll64.dll
ProcID: 0x0000000000002628 ( 9768 )
Process: C:\MC64\MultiCharts64.exe
Thread ID: 0x00000000000006E0 ( 1760 )
Time: 14.09.2019 - 09:48:01.657

Here is the code:

Code: Select all

var: myvar(0);
array: MyArray[5](0);
myvar = MyArray[0];
//Array_SetMaxIndex(MyArray, 5) ;
//Input:position [ x ](NumericArrayRef);
Vars: JulianDayUT(0), ret_flag(0), serr("");

DefineDLLFunc: "C:\Swiss Ephemeris\ephe\swedll64.dll",long,"swe_set_ephe_path",string;
swe_set_ephe_path("C:\Swiss Ephemeris\ephe");
DefineDLLFunc: "swedll64.dll",Double,"swe_julday",Long,Long,Long,Double,Long;
//I call it with this line.
JuliandayUT = swe_julday(2019, 9, 3, 1200, 1);
print("JulianDayUT= ",JulianDayUT);
//This is working fine and Julian day number is to find on every bar
//on the chart. Day of week function and others are also working.

DefineDLLFunc: "swedll64.dll",Long,"swe_calc",Double,Long,Long,Double,String;
ret_flag = swe_calc(JuliandayUT, 0, 274,myvar, serr);
MyArray[0]=myvar;
print("Long.= ",MyArray[0], "Lat.= ",MyArray[1]);
I think there should be another way to declare the array, or maybe a workaround as you suggested.
Sometimes I saw this type of array indicated as a "comvariant" array.

Meecc
Posts: 50
Joined: 23 Jun 2011
Has thanked: 22 times
Been thanked: 7 times

Re: Calling external DLL from Power Language with array passed by reference

Postby Meecc » 14 Sep 2019

Hello
my another guess,
also try changing
from String to lpstr
eg.
from
DefineDLLFunc: "swedll64.dll",Long,"swe_calc",Double,Long,Long,Double, String;
to
DefineDLLFunc: "swedll64.dll",Long,"swe_calc",Double,Long,Long,Double, lpstr;

Zheka
Posts: 223
Joined: 13 Jan 2016
Has thanked: 8 times
Been thanked: 53 times

Re: Calling external DLL from Power Language with array passed by reference

Postby Zheka » 14 Sep 2019

It probably has to do with wrong parameter type declaration in DefineDLL: passing an array(of doubles) requires a *pointer-to-double*, not just Double.

Try declaring it as LPDouble, and try finding an EasyLanguage Extention SDK referenced here: https://www.multicharts.com/trading-sof ... LL_Calling for clarifications and options.

gero65
Posts: 10
Joined: 12 Sep 2019
Has thanked: 4 times
Been thanked: 1 time

Re: Calling external DLL from Power Language with array passed by reference

Postby gero65 » 16 Sep 2019

Hello
my another guess,
also try changing
from String to lpstr
eg.
from
DefineDLLFunc: "swedll64.dll",Long,"swe_calc",Double,Long,Long,Double, String;
to
DefineDLLFunc: "swedll64.dll",Long,"swe_calc",Double,Long,Long,Double, lpstr;
Thanks Mecc, but the array should be a double not a string

Meecc
Posts: 50
Joined: 23 Jun 2011
Has thanked: 22 times
Been thanked: 7 times

Re: Calling external DLL from Power Language with array passed by reference

Postby Meecc » 16 Sep 2019

Explanation to my guess: String is not in the dll-calling keyword so my guess is to change your "String" to lpstr.
Please see the possible list in https://www.multicharts.com/trading-sof ... LL_Calling referenced given by zheka.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Calling external DLL from Power Language with array passed by reference

Postby janus » 20 Sep 2019

If you are still having problems it might be because the third party software handles arrays by reference differently. That will determine whether you need to pass the array by reference, pass an array of references to the array in question, or by pointer. Passing strings is more complicated as it depends on how strings are cast in the third party software. You need to get more information for the third party to determine how it's done. You may need to switch to MC.Net because passing data to external DLLs is handled in a more standardized fashion. If all else fails you might have to write a stub DLL in a another language that works with MC then the stub passes on the data to your third party software in the appropriate format and casting.

gero65
Posts: 10
Joined: 12 Sep 2019
Has thanked: 4 times
Been thanked: 1 time

Re: Calling external DLL from Power Language with array passed by reference

Postby gero65 » 21 Sep 2019

Thanks Meecc and Zheka,
I tested your suggestion but got a compilation error "Incorrect argument type" for MyArray, also writing it as MyArray, without "[0]"

This is the revised code:

Code: Select all

Vars: JulianDayUT(0), ret_flag(0), serr("");
array: MyArray[5](0);

// This call is working
DefineDLLFunc: "C:\Swiss Ephemeris\ephe\swedll64.dll",long,"swe_set_ephe_path",string;
swe_set_ephe_path("C:\Swiss Ephemeris\ephe");

// Also this call is working fine and Julian day number is printed on every bar.
DefineDLLFunc: "swedll64.dll",Double,"swe_julday",Long,Long,Long,Double,Long;
JuliandayUT = swe_julday(2019, 9, 3, 1200, 1);
print("JulianDayUT= ",JulianDayUT);

// This is not working
DefineDLLFunc: "swedll64.dll",Long,"swe_calc",Double,Long,Long,LPDouble,Lpstr;
ret_flag = swe_calc(JuliandayUT, 0, 274,MyArray[0], serr); // Compilation error "Incorrect argument type" for MyArray, also writing it as MyArray, wihtout "[0]"
print("Long.= ",MyArray[0], "Lat.= ",MyArray[1]);
The DLL is found by Power Language and the first function, swe_julday is working.

The problem is, as previously noted, passing the array "MyArray" in the function call swe_calc that needs to be passed by reference (as a pointer not the actual array value), as the function will return it back to the main Power Language script with the values in its 6 positions.

Some additional information:
The DLL is not written by me, is a third party package written in C++. I'm a programmer but worked on Cobol-CICS-DB2 on mainframe computers, I know a little bit Visual Basic but not C.
About ten years ago I wrote a "wrapper" for this swedll32.dll (same but 32 bit version) in VB6 as the old platform I was using required an ActiveX COM object in order to link external functions. It will be fantastic to be able to call this wrapper as I developed some additional function then that will help me with my project. However, also in my functions there are parameters passed by reference.
In VB6 there was the data type "ByRef" to define a parameter passed "by reference" and not with actual value.

In case this may help, this is the VB6 wrapper code for the function swe_calc, the array is X and is declared ByRef X As Variant, _:

Code: Select all

Private Declare Function swe_calc Lib "swedll32.dll" _
Alias "_swe_calc@24" ( _
ByVal tjd As Double, _
ByVal ipl As Long, _
ByVal iflag As Long, _
ByRef X As Double, _
ByVal serr As String _
) As Long ' x must be first of six array elements
' serr must be able to hold 256 bytes

Public Function SweCalc( _
ByVal tjd As Double, _
ByVal ipl As Long, _
ByVal iflag As Long, _
ByRef X As Variant, _
ByVal serr As String _
) As Long
Dim xs(6) As Double
serr$ = String(255, 0)
SweCalc = swe_calc(tjd, ipl, iflag, xs(1), serr$)
serr = set_strlen(serr$)
X(1) = xs(1)
X(2) = xs(2)
X(3) = xs(3)
X(4) = xs(4)
X(5) = xs(5)
X(6) = xs(6)

End Function
It will be enough for me to call the functions inside the wrapper... I can modify the wrapper code since it is in Visual Basic 6. I can also try to import and compile the wrapper code in Visual Basic .NET, using Visual Studio 2017.

Any thoughts or workaround is greatly appreciated!

Thanks,
Paolo

gero65
Posts: 10
Joined: 12 Sep 2019
Has thanked: 4 times
Been thanked: 1 time

Re: Calling external DLL from Power Language with array passed by reference

Postby gero65 » 26 Sep 2019

Please help...Any idea on how to pass an array by reference to an external DLL?
I can share my wrapper code in VB6 (but can compile it in VB.NET) if someone is interested.
It has some very useful function for the calculation of planetary position. Ask for any further information.
Thank you
Paolo

gero65
Posts: 10
Joined: 12 Sep 2019
Has thanked: 4 times
Been thanked: 1 time

Re: Calling external DLL from Power Language with array passed by reference

Postby gero65 » 26 Sep 2019

Janus,
Thanks for taking the time to reply.

Passing strings should have no issues since the first two calls work, I copied the code here for your convenience

Code: Select all

// This call is working
DefineDLLFunc: "C:\Swiss Ephemeris\ephe\swedll64.dll",long,"swe_set_ephe_path",string;
swe_set_ephe_path("C:\Swiss Ephemeris\ephe");

// Also this call is working fine and Julian day number is printed on every bar.
DefineDLLFunc: "swedll64.dll",Double,"swe_julday",Long,Long,Long,Double,Long;
JuliandayUT = swe_julday(2019, 9, 3, 1200, 1);
print("JulianDayUT= ",JulianDayUT);
I am trying to retrieve the DLL C++ code... in the meantime, this is the code of a working example that calls the swe_calc function, which is not working in Power Language. The array passed by reference is xobl.
I think that the difference between passing it by value or by reference in C++ is that passing variables by value you should indicate the index (in this case xobl[0]), while passing it by reference you simply write xobl.

Code: Select all

static double xobl[6]
iflgret = swe_calc(te, SE_ECL_NUT, iflag, xobl, serr);


If you have any further idea or workaround please advise!

Also if Multicharts technical support can help..... Henry?...

Paolo

kh_model
Posts: 43
Joined: 13 Jul 2005
Has thanked: 12 times

Re: Calling external DLL from Power Language with array passed by reference

Postby kh_model » 12 Nov 2020

Hello Gero65,

I modified your code slightly based on an old post by Marina Pashkova which dates back to 2008:

viewtopic.php?t=5608

While no errors are produced in the compiler or at runtime, there does not seem to be any information in the array other than a zero for each element. There is a successful return code for the swe_calc function. I placed swedll64.dll in C:\Windows\System32 folder.


Code: Select all

Vars: JulianDayUT(0), ret_flag(0), serr(""); array: double MyArray[6](0.0); // This call is working DefineDLLFunc: "swedll64.dll",long,"swe_set_ephe_path",string; swe_set_ephe_path("C:\sweph\ephe");

Code: Select all

// Also this call is working fine and Julian day number is printed on every bar. DefineDLLFunc: "swedll64.dll",Double,"swe_julday",Long,Long,Long,Double,Long; JuliandayUT = swe_julday(2019, 9, 3, 1200, 1); print("JulianDayUT= ",JulianDayUT);

Code: Select all

// This is partially working DefineDLLFunc: "swedll64.dll",Long,"swe_calc",Double,Long,Long,LPDouble,Lpstr; ret_flag = swe_calc(JuliandayUT, 0, 274, (double) &MyArray[0], serr); // print("Long.= ",MyArray[0], "Lat.= ",MyArray[1]);

Here is some sample output:

Code: Select all

JulianDayUT= 2458779.50 Long.= 0.00Lat.= 0.00 JulianDayUT= 2458779.50 Long.= 0.00Lat.= 0.00 JulianDayUT= 2458779.50 Long.= 0.00Lat.= 0.00 JulianDayUT= 2458779.50 Long.= 0.00Lat.= 0.00 JulianDayUT= 2458779.50 Long.= 0.00Lat.= 0.00

Can anyone suggest a way to get the expected values for Longitude and Latitude to appear in the array?
Will it be necessary to use the PLKit to make this work?
Is there a simpler way to solve the problem, and what do other people do when facing the same challenge?

I have attached a copy of the dll which was extracted from "swe2.05.01_built_on_win.zip" and minimal ephemeris files
minimal_ephe_2of2.zip
(1.46 MiB) Downloaded 131 times
minimal_ephe_1of2.zip
(623.27 KiB) Downloaded 128 times
swedll64.dll
(670.5 KiB) Downloaded 121 times

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Calling external DLL from Power Language with array passed by reference

Postby syswizard » 14 Nov 2020

Good stuff KH.
Do you know if there is any documentation for swedll64.dll ?
What are the functions that it performs ?

kh_model
Posts: 43
Joined: 13 Jul 2005
Has thanked: 12 times

Re: Calling external DLL from Power Language with array passed by reference

Postby kh_model » 14 Nov 2020

There is a dedicated team standing behind the swiss ephemeris project to whom we should all be very grateful.
The following url is a general starting point: https://www.astro.com/

Their programming interface is well documented here: https://www.astro.com/swisseph/swephprg.htm

In my own words, I would say that the swiss ephemeris is a .dll that provides access to accurate and efficient astronomical data for use within a larger software application. My experiments started with the 32bit version when I noticed that several important and well known astro finance programs had already used the swiss ephemeris as a foundation. The application of astronomical data to market analysis is not included within the swiss ephemeris as that is the province of third party software developers. We should all respect the fact that astronomical methods of market analysis are fairly secretive for a good reason, so I will suggest that you explore the topic of how W.D. Gann might have used astronomy and medieval astrology as a method of market analysis like a detective. Look patiently at the work of authors like Jeanne Long, Michael Jenkins, Bradley Cowan, Patrick Mikula, Dr. Al Larson, and Earik Beann to name just a few. That is what I was forced to do and it took years to form a complete understanding that never stops evolving it seems. Since no software implements everything that is needed, I sought to extend what was already available by adding a few extra astrobodies to the existing infrastructure of off-the-shelf astro finance software. With help from others on the internet, I implemented unpublished and proprietary C and CPP wrappers around the swedll32.dll for another program, but I did not yet do that for MultiCharts. It seemed at first glance that it would be a very beneficial shortcut in the development process to be able to call the swedll32.dll or swedll64.dll directly from within PoweLanguage and not need to use PLKit to build further layers of wrapper implementations, but as always, it seems that the battle for time and money reveals unexpected pitfalls at every turn. I say that in this case because it looks as if something that should work in fact does not, but sometimes that is just an illusion and is part of the general confusion of learning. We are often left without support in such areas and we must hope for the mercy of more experienced people and even pray to God for inspiration and courage to forge ahead in the darkness of misunderstood technology. So I will mention that it is a common practice for compilers to add "name mangling" to a 32bit dll, and that is why function calls to swedll32.dll from within a scripting language may often require unusual characters such as "@" or "_" or an unexpected numeral such as "24" to be mixed into the expected function name. Using a tool such as "dumpbin" one can reveal a list of the function names including any unexpected mangling that needs to be represented when defining the dll and calling the dll in PowerLanguage. On the other hand, I hope that I will not be incorrect for saying that it is not common practice for "name mangling" to occur within a 64 bit dll. Therefore, we might observe that the expected function names appear to be simpler and more plainly understood. I will include an excerpt from the previously published work of another person on the internet to provide the following list of function calls which were extracted by dumpbin (a tool within the microsoft visual studio development environment) from both the swedll32.dll and also the swedll64.dll. Please note that in my own personal attempts I was not able to extract meaningful information from the 64 bit dll that I tested using dumpbin but it worked fine for me with the swedll32.dll.

Excerpt from the published work of another author follows:

After running dumpbin /EXPORT on both swedll32.dll & swedll64.dll (from the file called swe2.05.01_built_on_win.zip found at http://www.astro.com/ftp/swisseph/) it appears the def file used would need to be adjusted depending which dll you used.

Results below:

Dump of file swedll32.dll

File Type: DLL

Section contains the following exports for swedll32.dll

00000000 characteristics
574DEB09 time date stamp Tue May 31 12:50:33 2016
0.00 version
1 ordinal base
143 number of functions
143 number of names

ordinal hint RVA name

1 0 00006F20 _swe_azalt@40
2 1 00011F80 _swe_azalt_d@28
3 2 00007130 _swe_azalt_rev@24
4 3 00011FD0 _swe_azalt_rev_d@20
5 4 00032A90 _swe_calc@24
6 5 00012000 _swe_calc_d@20
7 6 00032EE0 _swe_calc_ut@24
8 7 00012030 _swe_calc_ut_d@20
9 8 00032FA0 _swe_close@0
10 9 00012060 _swe_close_d@4
11 A 0003D2F0 _swe_cotrans@16
12 B 00012070 _swe_cotrans_d@12
13 C 0003D3A0 _swe_cotrans_sp@16
14 D 000120A0 _swe_cotrans_sp_d@12
15 E 0003D4A0 _swe_cs2degstr@8
16 F 000120D0 _swe_cs2degstr_d@8
17 10 0003D530 _swe_cs2lonlatstr@16
18 11 000120E0 _swe_cs2lonlatstr_d@16
19 12 0003D700 _swe_cs2timestr@16
20 13 00012100 _swe_cs2timestr_d@16
21 14 0003D830 _swe_csnorm@4
22 15 00012110 _swe_csnorm_d@4
23 16 0003D870 _swe_csroundsec@4
24 17 00012120 _swe_csroundsec_d@4
25 18 0003D8E0 _swe_d2l@8
26 19 00012130 _swe_d2l_d@4
27 1A 00011120 _swe_date_conversion@28
28 1B 00012150 _swe_date_conversion_d@24
29 1C 0003D920 _swe_day_of_week@8
30 1D 00012180 _swe_day_of_week_d@4
31 1E 0003D970 _swe_deg_midp@16
32 1F 0003D9C0 _swe_degnorm@8
33 20 000121A0 _swe_degnorm_d@4
34 21 0003DA20 _swe_deltat@8
35 22 000121D0 _swe_deltat_d@8
36 23 0003DA50 _swe_deltat_ex@16
37 24 0003DAA0 _swe_difcs2n@8
38 25 00012200 _swe_difcs2n_d@8
39 26 0003DAC0 _swe_difcsn@8
40 27 00012210 _swe_difcsn_d@8
41 28 0003DAE0 _swe_difdeg2n@16
42 29 00012220 _swe_difdeg2n_d@12
43 2A 0003DB20 _swe_difdegn@16
44 2B 00012250 _swe_difdegn_d@12
45 2C 0003DB40 _swe_difrad2n@16
46 2D 000330E0 _swe_fixstar@24
47 2E 00012280 _swe_fixstar_d@20
48 2F 00034850 _swe_fixstar_mag@12
49 30 00034DC0 _swe_fixstar_ut@24
50 31 000122B0 _swe_fixstar_ut_d@20
51 32 00007290 _swe_gauquelin_sector@52
52 33 00034E80 _swe_get_ayanamsa@8
53 34 000122E0 _swe_get_ayanamsa_d@8
54 35 00034EB0 _swe_get_ayanamsa_ex@20
55 36 00035590 _swe_get_ayanamsa_ex_ut@20
56 37 00035630 _swe_get_ayanamsa_name@4
57 38 00035660 _swe_get_ayanamsa_ut@8
58 39 00012310 _swe_get_ayanamsa_ut_d@8
59 3A 000356A0 _swe_get_library_path@4
60 3B 00007710 _swe_get_orbital_elements@24
61 3C 000356D0 _swe_get_planet_name@8
62 3D 00012340 _swe_get_planet_name_d@8
63 3E 0003DB80 _swe_get_tid_acc@0
64 3F 00012350 _swe_get_tid_acc_d@4
65 40 00019900 _swe_heliacal_angle@72
66 41 000199E0 _swe_heliacal_pheno_ut@40
67 42 0001A940 _swe_heliacal_ut@40
68 43 00021210 _swe_house_name@4
69 44 000213B0 _swe_house_pos@36
70 45 00012370 _swe_house_pos_d@28
71 46 00022DA0 _swe_houses@36
72 47 00022F00 _swe_houses_armc@36
73 48 000123E0 _swe_houses_armc_d@24
74 49 00012420 _swe_houses_d@24
75 4A 00023050 _swe_houses_ex@40
76 4B 00012460 _swe_houses_ex_d@28
77 4C 000111B0 _swe_jdet_to_utc@36
78 4D 000115A0 _swe_jdut1_to_utc@36
79 4E 000115F0 _swe_julday@24
80 4F 000124B0 _swe_julday_d@24
81 50 00035D10 _swe_lat_to_lmt@24
82 51 00035DA0 _swe_lmt_to_lat@24
83 52 00008370 _swe_lun_eclipse_how@24
84 53 000124E0 _swe_lun_eclipse_how_d@20
85 54 00008510 _swe_lun_eclipse_when@28
86 55 00012510 _swe_lun_eclipse_when_d@24
87 56 000094E0 _swe_lun_eclipse_when_loc@32
88 57 00009870 _swe_lun_occult_when_glob@36
89 58 0000AAD0 _swe_lun_occult_when_loc@40
90 59 0000AC70 _swe_lun_occult_where@32
91 5A 0000AD70 _swe_nod_aps@40
92 5B 00012540 _swe_nod_aps_d@36
93 5C 0000D140 _swe_nod_aps_ut@40
94 5D 00012580 _swe_nod_aps_ut_d@36
95 5E 0000D190 _swe_orbit_max_min_true_distance@32
96 5F 0000D850 _swe_pheno@24
97 60 000125C0 _swe_pheno_d@20
98 61 0000E590 _swe_pheno_ut@24
99 62 000125F0 _swe_pheno_ut_d@20
100 63 0003DB90 _swe_rad_midp@16
101 64 0003DBD0 _swe_radnorm@8
102 65 0000E630 _swe_refrac@28
103 66 00012620 _swe_refrac_d@20
104 67 0000E810 _swe_refrac_extended@48
105 68 00011800 _swe_revjul@28
106 69 00012660 _swe_revjul_d@24
107 6A 0000EA60 _swe_rise_trans@52
108 6B 00012690 _swe_rise_trans_d@40
109 6C 0000EAB0 _swe_rise_trans_true_hor@60
110 6D 0003DC30 _swe_set_astro_models@4
111 6E 0003DC80 _swe_set_delta_t_userdef@8
112 6F 00035DF0 _swe_set_ephe_path@4
113 70 000126E0 _swe_set_ephe_path_d@4
114 71 00036010 _swe_set_jpl_file@4
115 72 00012700 _swe_set_jpl_file_d@4
116 73 0000F9A0 _swe_set_lapse_rate@8
117 74 000360C0 _swe_set_sid_mode@20
118 75 00012720 _swe_set_sid_mode_d@12
119 76 0003DCC0 _swe_set_tid_acc@8
120 77 00012750 _swe_set_tid_acc_d@4
121 78 00036200 _swe_set_topo@24
122 79 00012770 _swe_set_topo_d@12
123 7A 0003DD10 _swe_sidtime0@24
124 7B 000127B0 _swe_sidtime0_d@16
125 7C 0003E170 _swe_sidtime@8
126 7D 000127F0 _swe_sidtime_d@8
127 7E 0000F9C0 _swe_sol_eclipse_how@24
128 7F 00012820 _swe_sol_eclipse_how_d@20
129 80 0000FBC0 _swe_sol_eclipse_when_glob@28
130 81 00012850 _swe_sol_eclipse_when_glob_d@24
131 82 00010D60 _swe_sol_eclipse_when_loc@32
132 83 00012880 _swe_sol_eclipse_when_loc_d@28
133 84 00010EB0 _swe_sol_eclipse_where@24
134 85 000128B0 _swe_sol_eclipse_where_d@20
135 86 0003E210 _swe_split_deg@32
136 87 000128E0 _swe_split_deg_d@28
137 88 00036290 _swe_time_equ@16
138 89 00012910 _swe_time_equ_d@12
139 8A 0001AF30 _swe_topo_arcus_visionis@80
140 8B 00011A80 _swe_utc_time_zone@60
141 8C 00011BC0 _swe_utc_to_jd@40
142 8D 000363F0 _swe_version@4
143 8E 0001B010 _swe_vis_limit_mag@36

Dump of file swedll64.dll

File Type: DLL

Section contains the following exports for swedll64.dll

00000000 characteristics
57485260 time date stamp Fri May 27 06:57:52 2016
0.00 version
1 ordinal base
143 number of functions
143 number of names

ordinal hint RVA name

1 0 0000C8F9 swe_azalt
2 1 0001B7BC swe_azalt_d
3 2 0000CBC4 swe_azalt_rev
4 3 0001B82B swe_azalt_rev_d
5 4 0001BA44 swe_calc
6 5 0001AAF2 swe_calc_d
7 6 0001C390 swe_calc_ut
8 7 0001AB38 swe_calc_ut_d
9 8 0001E637 swe_close
10 9 0001AC18 swe_close_d
11 A 00035707 swe_cotrans
12 B 0001AE85 swe_cotrans_d
13 C 00035864 swe_cotrans_sp
14 D 0001AEC4 swe_cotrans_sp_d
15 E 0003F950 swe_cs2degstr
16 F 0001B4DF swe_cs2degstr_d
17 10 0003F6B2 swe_cs2lonlatstr
18 11 0001B49A swe_cs2lonlatstr_d
19 12 0003F42C swe_cs2timestr
20 13 0001B464 swe_cs2timestr_d
21 14 0003F14F swe_csnorm
22 15 0001B2A5 swe_csnorm_d
23 16 0003F2E1 swe_csroundsec
24 17 0001B3A0 swe_csroundsec_d
25 18 0003F362 swe_d2l
26 19 0001B3B9 swe_d2l_d
27 1A 0004BDC0 swe_date_conversion
28 1B 0001AF8F swe_date_conversion_d
29 1C 0003F3A6 swe_day_of_week
30 1D 0001B43D swe_day_of_week_d
31 1E 000352B6 swe_deg_midp
32 1F 00035190 swe_degnorm
33 20 0001AF57 swe_degnorm_d
34 21 0003C2DA swe_deltat
35 22 0001AD55 swe_deltat_d
36 23 0003C275 swe_deltat_ex
37 24 0003F1DF swe_difcs2n
38 25 0001B32F swe_difcs2n_d
39 26 0003F189 swe_difcsn
40 27 0001B2BE swe_difcsn_d
41 28 0003F219 swe_difdeg2n
42 29 0001B350 swe_difdeg2n_d
43 2A 0003F1AA swe_difdegn
44 2B 0001B2DF swe_difdegn_d
45 2C 0003F27D swe_difrad2n
46 2D 00030D8F swe_fixstar
47 2E 0001AB7E swe_fixstar_d
48 2F 000333F0 swe_fixstar_mag
49 30 000332D3 swe_fixstar_ut
50 31 0001ABCB swe_fixstar_ut_d
51 32 0001A37D swe_gauquelin_sector
52 33 0002441D swe_get_ayanamsa
53 34 0001ACDD swe_get_ayanamsa_d
54 35 000237FA swe_get_ayanamsa_ex
55 36 00024348 swe_get_ayanamsa_ex_ut
56 37 0003430E swe_get_ayanamsa_name
57 38 00024461 swe_get_ayanamsa_ut
58 39 0001AD19 swe_get_ayanamsa_ut_d
59 3A 0001B9EF swe_get_library_path
60 3B 00017DB0 swe_get_orbital_elements
61 3C 00033B2E swe_get_planet_name
62 3D 0001AC73 swe_get_planet_name_d
63 3E 0003D71F swe_get_tid_acc
64 3F 0001AF03 swe_get_tid_acc_d
65 40 0005F7A0 swe_heliacal_angle
66 41 00060008 swe_heliacal_pheno_ut
67 42 00066276 swe_heliacal_ut
68 43 0004F408 swe_house_name
69 44 0005572E swe_house_pos
70 45 0001B208 swe_house_pos_d
71 46 0004D550 swe_houses
72 47 0004ED73 swe_houses_armc
73 48 0001B19F swe_houses_armc_d
74 49 0001B0C8 swe_houses_d
75 4A 0004D71B swe_houses_ex
76 4B 0001B131 swe_houses_ex_d
77 4C 0004CD98 swe_jdet_to_utc
78 4D 0004D4C3 swe_jdut1_to_utc
79 4E 0004BE8D swe_julday
80 4F 0001AFE3 swe_julday_d
81 50 00034DC5 swe_lat_to_lmt
82 51 00034D49 swe_lmt_to_lat
83 52 0000D706 swe_lun_eclipse_how
84 53 0001B632 swe_lun_eclipse_how_d
85 54 0000E4F0 swe_lun_eclipse_when
86 55 0001B678 swe_lun_eclipse_when_d
87 56 0000FCFE swe_lun_eclipse_when_loc
88 57 00005745 swe_lun_occult_when_glob
89 58 00007764 swe_lun_occult_when_loc
90 59 0000152C swe_lun_occult_where
91 5A 00013618 swe_nod_aps
92 5B 0001B8F4 swe_nod_aps_d
93 5C 000178E1 swe_nod_aps_ut
94 5D 0001B95E swe_nod_aps_ut_d
95 5E 00019BE1 swe_orbit_max_min_true_distance
96 5F 0001034F swe_pheno
97 60 0001B6C5 swe_pheno_d
98 61 000117B2 swe_pheno_ut
99 62 0001B70B swe_pheno_ut_d
100 63 0003531F swe_rad_midp
101 64 00035223 swe_radnorm
102 65 0000CDA8 swe_refrac
103 66 0001B751 swe_refrac_d
104 67 0000D0F3 swe_refrac_extended
105 68 0004C107 swe_revjul
106 69 0001B03A swe_revjul_d
107 6A 00011BB9 swe_rise_trans
108 6B 0001B876 swe_rise_trans_d
109 6C 00011C30 swe_rise_trans_true_hor
110 6D 00040124 swe_set_astro_models
111 6E 0003D7BB swe_set_delta_t_userdef
112 6F 0001E858 swe_set_ephe_path
113 70 0001AC33 swe_set_ephe_path_d
114 71 0001EF70 swe_set_jpl_file
115 72 0001AC53 swe_set_jpl_file_d
116 73 0000D0DD swe_set_lapse_rate
117 74 0002361D swe_set_sid_mode
118 75 0001AC97 swe_set_sid_mode_d
119 76 0003D744 swe_set_tid_acc
120 77 0001AF2B swe_set_tid_acc_d
121 78 0003434D swe_set_topo
122 79 0001AE31 swe_set_topo_d
123 7A 0003EB52 swe_sidtime
124 7B 0003E4AD swe_sidtime0
125 7C 0001AD91 swe_sidtime0_d
126 7D 0001ADF5 swe_sidtime_d
127 7E 0000289F swe_sol_eclipse_how
128 7F 0001B549 swe_sol_eclipse_how_d
129 80 000039B9 swe_sol_eclipse_when_glob
130 81 0001B5E5 swe_sol_eclipse_when_glob_d
131 82 00007562 swe_sol_eclipse_when_loc
132 83 0001B58F swe_sol_eclipse_when_loc_d
133 84 00001430 swe_sol_eclipse_where
134 85 0001B503 swe_sol_eclipse_where_d
135 86 0003FAAA swe_split_deg
136 87 0001B3E0 swe_split_deg_d
137 88 00034A90 swe_time_equ
138 89 0001B08E swe_time_equ_d
139 8A 0005F054 swe_topo_arcus_visionis
140 8B 0004C3AD swe_utc_time_zone
141 8C 0004C7E3 swe_utc_to_jd
142 8D 0001B9D0 swe_version
143 8E 0005E666 swe_vis_limit_mag

gero65
Posts: 10
Joined: 12 Sep 2019
Has thanked: 4 times
Been thanked: 1 time

Re: Calling external DLL from Power Language with array passed by reference

Postby gero65 » 15 Nov 2020

Hi kh_model,

Thanks for your reply. I talked to an expert programmer a few weeks ago about this issue and he stated that it is unlikely to obtain an array returning from a function call in easylanguage. To obtain the three funudamental values by swe_calc function (longitude,latitude and speed) it will be necessary to create three separate functions each one returning a single value. To do this the fastest way will be to create, for every Swiss Ephemeris function that is needed, a wrapper that receives the function parameters from easylanguage and then calls the original Swiss Ephemeris function. This will work for sure if done in C++ or C#, may be also with other languages. Hope that this helps.

amw_775
Posts: 21
Joined: 19 Apr 2020
Has thanked: 1 time
Been thanked: 11 times

Re: Calling external DLL from Power Language with array passed by reference

Postby amw_775 » 11 Jul 2022

Actually , Im able to load up an array with a external DLL. using PLKIT
You have to pass the array name to the DLL and it can be done. PM me for any guidance


Return to “MultiCharts”