[OSRS-PROJ] delphi API Conversion for proj.dll
Alexander Weidauer
alex.weidauer at huckfinn.de
Wed Jul 17 04:09:56 PDT 2002
bornkilled wrote:
> hi, I want to make a delphi API Conversion for proj.dll( I have
> compile it by VC6)
>
> I wrote pas in this way
>
> unit proj_dll;
>
> interface
> uses
> windows;
> const
> ProjDll='proj.dll';
> type
> projPJ=Pointer;
> XY=record
> X:Double;
> Y:Double;
> end;
> UV=XY;
> LP=XY;
>
> function pj_init(argc:DWord;argv:PLPSTR):projPJ;stdcall;
> function pj_init_plus(definition:PChar):projPJ;stdcall;
> procedure pj_free(var P:projPJ);stdcall;
>
> procedure pj_deallocate_grids();stdcall;
> function pj_errno():DWORD;stdcall;
>
> function pj_fwd(aLP:LP;P:projPJ):XY;stdcall;
> function pj_inv(aXY:LP;P:projPJ):LP;stdcall;
> function pj_is_latlong(P:projPJ):DWORD;stdcall;
> implementation
> function pj_init;external ProjDll Name 'pj_init';
> function pj_init_plus;external ProjDll Name 'pj_init_plus';
> procedure pj_free;external ProjDll Name 'pj_free';
> procedure pj_deallocate_grids();external ProjDll Name
> 'pj_deallocate_grids';
> function pj_errno;external ProjDll Name 'pj_errno';
> function pj_fwd;external ProjDll Name 'pj_fwd';
> function pj_inv;external ProjDll Name 'pj_inv';
> function pj_is_latlong ;external ProjDll Name 'pj_is_latlong';
>
> But I meet some trouble :
>
> 1:pj_errno make an exception "Access Violation" in any case;
>
> 2:I can not find the excatly definition of PJ*,so i can not use
> pj_free(),that will cause a memory leak .
>
> 3:pj_fwd will raise stack overflow in the case of the code below:
>
> procedure TForm2.Button1Click(Sender: TObject);
> var
> P:projPJ;
> errorno:Integer;
> temp:XY;
> temp1:XY;
> nu:Cardinal;
> i:Integer;
> begin
> P:=pj_init_plus(PChar(' +proj=utm +zone=11 +ellps=WGS84));
>
> i:=pj_errno;
> temp.X:=0;temp.Y:=0;
> nu:=GetTickCount;
> for i:=0 to 50000 do
> temp1:=pj_inv(temp,P);
> ShowMessage(IntToStr(GetTickCount-nu));
>
> end;
>
> if i<40000 there is no problem
>
> Bornkilled at 21cn.com <mailto:Bornkilled at 21cn.com>
>
Hi,
I've compiled the proj library under the free borland C++ 5.5 compiler with
a complete different makefile and some changes in the original code to
prevent the use of environment variables under WinNT. The functions are
all not tested now but I have a little bit different interface file Proj
API.
I've a C++ Proj Library wrapper written in Borland C++ and a test
applicaqtion
in Delphi too they make no errors.
I' will leave you the code under freemozilla cnditions if you want
because there is no
time to finish and test the Delphi API now.
Please send me a mail to alex.weidauer at huckfinn.de.
Bye Alex
----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.
More information about the Proj
mailing list