Je voudrai utiliser un dll de window spécialisée dans le calcul astronomique. Malheureusement, je n'arrive pas à obtenir un résulat avec cette DLL.En visual basic la fonction que je veux utiliser est déclaré comme suit:
Private Declare Function swe_julday Lib "swedll32.dll" _
Alias "_swe_julday@24" ( _
ByVal Year As Long, _
ByVal Month As Long, _
ByVal Day As Long, _
ByVal hour As Double, _
ByVal gregflg As Long _
) As Double
Private Declare Function swe_julday_d Lib "swedll32.dll" _
Alias "_swe_julday_d@24" ( _
ByVal Year As Long, _
ByVal Month As Long, _
ByVal Day As Long, _
ByRef hour As Double, _
ByVal gregflg As Long, _
ByRef tjd As Double _
) As Long
En PureBasic je déclare toutes les fonctions de la DLL de la façon suivante:
Code : Tout sélectionner
Global annee.w,jour.w,mois.w,heure.f,jld_ut.f
Procedure Initswedll32(libid,libname.s)
If OpenLibrary(libid,libname)
Global *swe_azalt
*swe_azalt=IsFunction(libid,"_swe_azalt@40")
Global *swe_azalt_d
*swe_azalt_d=IsFunction(libid,"_swe_azalt_d@28")
Global *swe_azalt_rev
*swe_azalt_rev=IsFunction(libid,"_swe_azalt_rev@24")
Global *swe_azalt_rev_d
*swe_azalt_rev_d=IsFunction(libid,"_swe_azalt_rev_d@20")
Global *swe_calc
*swe_calc=IsFunction(libid,"_swe_calc@24")
Global *swe_calc_d
*swe_calc_d=IsFunction(libid,"_swe_calc_d@20")
Global *swe_calc_ut
*swe_calc_ut=IsFunction(libid,"_swe_calc_ut@24")
Global *swe_calc_ut_d
*swe_calc_ut_d=IsFunction(libid,"_swe_calc_ut_d@20")
Global *swe_close
*swe_close=IsFunction(libid,"_swe_close@0")
Global *swe_close_d
*swe_close_d=IsFunction(libid,"_swe_close_d@4")
Global *swe_cotrans
*swe_cotrans=IsFunction(libid,"_swe_cotrans@16")
Global *swe_cotrans_d
*swe_cotrans_d=IsFunction(libid,"_swe_cotrans_d@12")
Global *swe_cotrans_sp
*swe_cotrans_sp=IsFunction(libid,"_swe_cotrans_sp@16")
Global *swe_cotrans_sp_d
*swe_cotrans_sp_d=IsFunction(libid,"_swe_cotrans_sp_d@12")
Global *swe_cs2degstr
*swe_cs2degstr=IsFunction(libid,"_swe_cs2degstr@8")
Global *swe_cs2degstr_d
*swe_cs2degstr_d=IsFunction(libid,"_swe_cs2degstr_d@8")
Global *swe_cs2lonlatstr
*swe_cs2lonlatstr=IsFunction(libid,"_swe_cs2lonlatstr@16")
Global *swe_cs2lonlatstr_d
*swe_cs2lonlatstr_d=IsFunction(libid,"_swe_cs2lonlatstr_d@16")
Global *swe_cs2timestr
*swe_cs2timestr=IsFunction(libid,"_swe_cs2timestr@16")
Global *swe_cs2timestr_d
*swe_cs2timestr_d=IsFunction(libid,"_swe_cs2timestr_d@16")
Global *swe_csnorm
*swe_csnorm=IsFunction(libid,"_swe_csnorm@4")
Global *swe_csnorm_d
*swe_csnorm_d=IsFunction(libid,"_swe_csnorm_d@4")
Global *swe_csroundsec
*swe_csroundsec=IsFunction(libid,"_swe_csroundsec@4")
Global *swe_csroundsec_d
*swe_csroundsec_d=IsFunction(libid,"_swe_csroundsec_d@4")
Global *swe_d2l
*swe_d2l=IsFunction(libid,"_swe_d2l@8")
Global *swe_d2l_d
*swe_d2l_d=IsFunction(libid,"_swe_d2l_d@4")
Global *swe_date_conversion
*swe_date_conversion=IsFunction(libid,"_swe_date_conversion@28")
Global *swe_date_conversion_d
*swe_date_conversion_d=IsFunction(libid,"_swe_date_conversion_d@24")
Global *swe_day_of_week
*swe_day_of_week=IsFunction(libid,"_swe_day_of_week@8")
Global *swe_day_of_week_d
*swe_day_of_week_d=IsFunction(libid,"_swe_day_of_week_d@4")
Global *swe_deg_midp
*swe_deg_midp=IsFunction(libid,"_swe_deg_midp@16")
Global *swe_degnorm
*swe_degnorm=IsFunction(libid,"_swe_degnorm@8")
Global *swe_degnorm_d
*swe_degnorm_d=IsFunction(libid,"_swe_degnorm_d@4")
Global *swe_deltat
*swe_deltat=IsFunction(libid,"_swe_deltat@8")
Global *swe_deltat_d
*swe_deltat_d=IsFunction(libid,"_swe_deltat_d@8")
Global *swe_difcs2n
*swe_difcs2n=IsFunction(libid,"_swe_difcs2n@8")
Global *swe_difcs2n_d
*swe_difcs2n_d=IsFunction(libid,"_swe_difcs2n_d@8")
Global *swe_difcsn
*swe_difcsn=IsFunction(libid,"_swe_difcsn@8")
Global *swe_difcsn_d
*swe_difcsn_d=IsFunction(libid,"_swe_difcsn_d@8")
Global *swe_difdeg2n
*swe_difdeg2n=IsFunction(libid,"_swe_difdeg2n@16")
Global *swe_difdeg2n_d
*swe_difdeg2n_d=IsFunction(libid,"_swe_difdeg2n_d@12")
Global *swe_difdegn
*swe_difdegn=IsFunction(libid,"_swe_difdegn@16")
Global *swe_difdegn_d
*swe_difdegn_d=IsFunction(libid,"_swe_difdegn_d@12")
Global *swe_difrad2n
*swe_difrad2n=IsFunction(libid,"_swe_difrad2n@16")
Global *swe_fixstar
*swe_fixstar=IsFunction(libid,"_swe_fixstar@24")
Global *swe_fixstar_d
*swe_fixstar_d=IsFunction(libid,"_swe_fixstar_d@20")
Global *swe_fixstar_ut
*swe_fixstar_ut=IsFunction(libid,"_swe_fixstar_ut@24")
Global *swe_fixstar_ut_d
*swe_fixstar_ut_d=IsFunction(libid,"_swe_fixstar_ut_d@20")
Global *swe_gauquelin_sector
*swe_gauquelin_sector=IsFunction(libid,"_swe_gauquelin_sector@52")
Global *swe_get_ayanamsa
*swe_get_ayanamsa=IsFunction(libid,"_swe_get_ayanamsa@8")
Global *swe_get_ayanamsa_d
*swe_get_ayanamsa_d=IsFunction(libid,"_swe_get_ayanamsa_d@8")
Global *swe_get_ayanamsa_name
*swe_get_ayanamsa_name=IsFunction(libid,"_swe_get_ayanamsa_name@4")
Global *swe_get_ayanamsa_ut
*swe_get_ayanamsa_ut=IsFunction(libid,"_swe_get_ayanamsa_ut@8")
Global *swe_get_ayanamsa_ut_d
*swe_get_ayanamsa_ut_d=IsFunction(libid,"_swe_get_ayanamsa_ut_d@8")
Global *swe_get_planet_name
*swe_get_planet_name=IsFunction(libid,"_swe_get_planet_name@8")
Global *swe_get_planet_name_d
*swe_get_planet_name_d=IsFunction(libid,"_swe_get_planet_name_d@8")
Global *swe_get_tid_acc
*swe_get_tid_acc=IsFunction(libid,"_swe_get_tid_acc@0")
Global *swe_get_tid_acc_d
*swe_get_tid_acc_d=IsFunction(libid,"_swe_get_tid_acc_d@4")
Global *swe_house_pos
*swe_house_pos=IsFunction(libid,"_swe_house_pos@36")
Global *swe_house_pos_d
*swe_house_pos_d=IsFunction(libid,"_swe_house_pos_d@28")
Global *swe_houses
*swe_houses=IsFunction(libid,"_swe_houses@36")
Global *swe_houses_armc
*swe_houses_armc=IsFunction(libid,"_swe_houses_armc@36")
Global *swe_houses_armc_d
*swe_houses_armc_d=IsFunction(libid,"_swe_houses_armc_d@24")
Global *swe_houses_d
*swe_houses_d=IsFunction(libid,"_swe_houses_d@24")
Global *swe_houses_ex
*swe_houses_ex=IsFunction(libid,"_swe_houses_ex@40")
Global *swe_houses_ex_d
*swe_houses_ex_d=IsFunction(libid,"_swe_houses_ex_d@28")
Global *swe_julday
*swe_julday=IsFunction(libid,"_swe_julday@24")
Global *swe_julday_d
*swe_julday_d=IsFunction(libid,"_swe_julday_d@24")
Global *swe_lun_eclipse_how
*swe_lun_eclipse_how=IsFunction(libid,"_swe_lun_eclipse_how@24")
Global *swe_lun_eclipse_how_d
*swe_lun_eclipse_how_d=IsFunction(libid,"_swe_lun_eclipse_how_d@20")
Global *swe_lun_eclipse_when
*swe_lun_eclipse_when=IsFunction(libid,"_swe_lun_eclipse_when@28")
Global *swe_lun_eclipse_when_d
*swe_lun_eclipse_when_d=IsFunction(libid,"_swe_lun_eclipse_when_d@24")
Global *swe_lun_occult_when_glob
*swe_lun_occult_when_glob=IsFunction(libid,"_swe_lun_occult_when_glob@36")
Global *swe_lun_occult_when_loc
*swe_lun_occult_when_loc=IsFunction(libid,"_swe_lun_occult_when_loc@40")
Global *swe_lun_occult_where
*swe_lun_occult_where=IsFunction(libid,"_swe_lun_occult_where@32")
Global *swe_nod_aps
*swe_nod_aps=IsFunction(libid,"_swe_nod_aps@40")
Global *swe_nod_aps_d
*swe_nod_aps_d=IsFunction(libid,"_swe_nod_aps_d@36")
Global *swe_nod_aps_ut
*swe_nod_aps_ut=IsFunction(libid,"_swe_nod_aps_ut@40")
Global *swe_nod_aps_ut_d
*swe_nod_aps_ut_d=IsFunction(libid,"_swe_nod_aps_ut_d@36")
Global *swe_pheno
*swe_pheno=IsFunction(libid,"_swe_pheno@24")
Global *swe_pheno_d
*swe_pheno_d=IsFunction(libid,"_swe_pheno_d@20")
Global *swe_pheno_ut
*swe_pheno_ut=IsFunction(libid,"_swe_pheno_ut@24")
Global *swe_pheno_ut_d
*swe_pheno_ut_d=IsFunction(libid,"_swe_pheno_ut_d@20")
Global *swe_rad_midp
*swe_rad_midp=IsFunction(libid,"_swe_rad_midp@16")
Global *swe_radnorm
*swe_radnorm=IsFunction(libid,"_swe_radnorm@8")
Global *swe_refrac
*swe_refrac=IsFunction(libid,"_swe_refrac@28")
Global *swe_refrac_d
*swe_refrac_d=IsFunction(libid,"_swe_refrac_d@20")
Global *swe_revjul
*swe_revjul=IsFunction(libid,"_swe_revjul@28")
Global *swe_revjul_d
*swe_revjul_d=IsFunction(libid,"_swe_revjul_d@24")
Global *swe_rise_trans
*swe_rise_trans=IsFunction(libid,"_swe_rise_trans@52")
Global *swe_rise_trans_d
*swe_rise_trans_d=IsFunction(libid,"_swe_rise_trans_d@40")
Global *swe_set_ephe_path
*swe_set_ephe_path=IsFunction(libid,"_swe_set_ephe_path@4")
Global *swe_set_ephe_path_d
*swe_set_ephe_path_d=IsFunction(libid,"_swe_set_ephe_path_d@4")
Global *swe_set_jpl_file
*swe_set_jpl_file=IsFunction(libid,"_swe_set_jpl_file@4")
Global *swe_set_jpl_file_d
*swe_set_jpl_file_d=IsFunction(libid,"_swe_set_jpl_file_d@4")
Global *swe_set_sid_mode
*swe_set_sid_mode=IsFunction(libid,"_swe_set_sid_mode@20")
Global *swe_set_sid_mode_d
*swe_set_sid_mode_d=IsFunction(libid,"_swe_set_sid_mode_d@12")
Global *swe_set_tid_acc
*swe_set_tid_acc=IsFunction(libid,"_swe_set_tid_acc@8")
Global *swe_set_tid_acc_d
*swe_set_tid_acc_d=IsFunction(libid,"_swe_set_tid_acc_d@4")
Global *swe_set_topo
*swe_set_topo=IsFunction(libid,"_swe_set_topo@24")
Global *swe_set_topo_d
*swe_set_topo_d=IsFunction(libid,"_swe_set_topo_d@12")
Global *swe_sidtime0
*swe_sidtime0=IsFunction(libid,"_swe_sidtime0@24")
Global *swe_sidtime0_d
*swe_sidtime0_d=IsFunction(libid,"_swe_sidtime0_d@16")
Global *swe_sidtime
*swe_sidtime=IsFunction(libid,"_swe_sidtime@8")
Global *swe_sidtime_d
*swe_sidtime_d=IsFunction(libid,"_swe_sidtime_d@8")
Global *swe_sol_eclipse_how
*swe_sol_eclipse_how=IsFunction(libid,"_swe_sol_eclipse_how@24")
Global *swe_sol_eclipse_how_d
*swe_sol_eclipse_how_d=IsFunction(libid,"_swe_sol_eclipse_how_d@20")
Global *swe_sol_eclipse_when_glob
*swe_sol_eclipse_when_glob=IsFunction(libid,"_swe_sol_eclipse_when_glob@28")
Global *swe_sol_eclipse_when_glob_d
*swe_sol_eclipse_when_glob_d=IsFunction(libid,"_swe_sol_eclipse_when_glob_d@24")
Global *swe_sol_eclipse_when_loc
*swe_sol_eclipse_when_loc=IsFunction(libid,"_swe_sol_eclipse_when_loc@32")
Global *swe_sol_eclipse_when_loc_d
*swe_sol_eclipse_when_loc_d=IsFunction(libid,"_swe_sol_eclipse_when_loc_d@28")
Global *swe_sol_eclipse_where
*swe_sol_eclipse_where=IsFunction(libid,"_swe_sol_eclipse_where@24")
Global *swe_sol_eclipse_where_d
*swe_sol_eclipse_where_d=IsFunction(libid,"_swe_sol_eclipse_where_d@20")
Global *swe_split_deg
*swe_split_deg=IsFunction(libid,"_swe_split_deg@32")
Global *swe_split_deg_d
*swe_split_deg_d=IsFunction(libid,"_swe_split_deg_d@28")
Global *swe_time_equ
*swe_time_equ=IsFunction(libid,"_swe_time_equ@16")
Global *swe_time_equ_d
*swe_time_equ_d=IsFunction(libid,"_swe_time_equ_d@12")
Else
MessageRequester("error!","Can't open library!",0)
EndIf
EndProcedure
annee=2000
mois=1
jour=1
heure=9.50
initswedll32(0,"swedll32.dll")
;jld=CallFunction(0,"_swe_julday@24",annee,mois,jour,heure,1)
jld_ut=CallFunctionFast(*swe_julday,annee,mois,jour,heure,1)
;
Debug jld_ut
Je fais peut être une erreur en utilisant la DLL

Est_ce que ma façon de procéder vous semble bonne

Je sais que ce n'est pas évident et que vous n'avez surement pas la DLL mais je peux la transmettre à votre adresse si vous voulez vérifier.
Merci d'avance je continue mes recherches....