LL2TRSM.DLL routine

This routine converts a latitude & longitude to the legal location, including Township, Range, Section, Meridian and State.

Inputs are the latitude and longitude. The state may also be entered. This is sometimes necessary when the location is close to state borders where the border is irregular.

 

This is the calling routine from Visual Basic

‘-------------------------------------------------------------------------------------

Option Explicit

Private Sub Command1_Click()

lat = InputBox("enter latitude xx.xxx")

lng = InputBox("enter longitude xxx.xxx")

state = InputBox("OPTIONAL/enter state XX")

Call ll2trsm(lat, lng, trsm, Len(trsm), meridian, Len(meridian), state, Len(state))

MsgBox "TRS=" & trsm & " Meridian=" & meridian & " state=" & state

End Sub

‘---------------------------------------------------------------------------------------------------

And this is the Module declaration.

‘--------------------------------------------------------------------------------------------

Option Explicit

Public lat As Single

Public lng As Single

Public state As String * 2

Public meridian As String * 2

Public trsm As String * 16

Declare Sub ll2trsm Lib _

"LL2TRSM.DLL" _

(lat As Single, _

lng As Single, _

ByVal trsm As String, ByVal l1 As Long, _

ByVal meridian As String, ByVal l2 As Long, _

ByVal state As String, ByVal l3 As Long)

‘---------------------------------------------------------------------------------

 

Passing strings from VB to Fortran is certainly confusing. Fortran passes strings in two arguments. The first is the strings address and the second is the strings length declared as Long. In VB the string is declared as ByVal. Integer and floating numbers are passed by reference. So no extra action is required.

The above examples should be followed exactly.

 

The DLL is written in Digital Visual Fortran version 5.0D.

This is the Fortran routine being called.

‘

‘---------------------------------------------------------------------------

SUBROUTINE ll2trsm(latitude,longitude,trsm,meridian,state)

IMPLICIT NONE

!DEC$ ATTRIBUTES DLLEXPORT :: ll2trsm

!DEC$ ATTRIBUTES ALIAS: 'll2trsm' :: ll2trsm

REAL :: latitude,longitude

CHARACTER*(*)state,meridian,trsm

INTEGER mistake

CALL LL2TRS(latitude,longitude,trsm,meridian,state,mistake)

RETURN

END

‘--------------------------------------------------------------------

The following Digital Visual Fortran DLLs must be present on you computer:

DFORRT.DLL

DFORMD.DLL

MSVCRT.DLL

 

Below are some links to Visual Fortrans documentation on calling Visual Fortran DLLs.

Compaq bought out Digital and the HP bought out Compaq so I guess it is now called HP Visual Fortran.

Calling Visual Fortran from Visual Basic

http://h18009.www1.hp.com/fortran/docs/vf-html/pg/pgwvbusr.htm

You are on your own in C++. I don’t know C++.

VISUAL C/C++ CALLING VISUAL FORTRAN DLL EXAMPLE

http://h18009.www1.hp.com/fortran/examples/vc-example1.html

Download
Download the DLLs as a zip file

Hosted by www.Geocities.ws

1