<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 5.50.4916.2300" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>hi, I want to make a delphi API Conversion
for proj.dll( I have compile it by VC6)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>I wrote pas in this
way</FONT></DIV>
<DIV><FONT face=Arial size=2>unit proj_dll;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>interface<BR>uses<BR>
windows;<BR>const<BR> ProjDll='proj.dll';<BR>type<BR>
projPJ=Pointer;<BR> XY=record<BR>
X:Double;<BR> Y:Double;<BR> end;<BR>
UV=XY;<BR> LP=XY;</FONT></DIV>
<DIV><FONT face=Arial size=2> function
pj_init(argc:DWord;argv:PLPSTR):projPJ;stdcall;<BR> function
pj_init_plus(definition:PChar):projPJ;stdcall;<BR> procedure pj_free(var
P:projPJ);stdcall;</FONT></DIV>
<DIV><FONT face=Arial size=2> procedure
pj_deallocate_grids();stdcall;<BR> function
pj_errno():DWORD;stdcall;</FONT></DIV>
<DIV><FONT face=Arial size=2> function
pj_fwd(aLP:LP;P:projPJ):XY;stdcall;<BR> function
pj_inv(aXY:LP;P:projPJ):LP;stdcall;<BR> function
pj_is_latlong(P:projPJ):DWORD;stdcall;<BR>implementation<BR> function
pj_init;external ProjDll Name 'pj_init';<BR> function
pj_init_plus;external ProjDll Name 'pj_init_plus';<BR> procedure
pj_free;external ProjDll Name 'pj_free';<BR> procedure
pj_deallocate_grids();external ProjDll Name 'pj_deallocate_grids';<BR>
function pj_errno;external ProjDll Name 'pj_errno';<BR> function
pj_fwd;external ProjDll Name 'pj_fwd';<BR> function pj_inv;external
ProjDll Name 'pj_inv';<BR> function pj_is_latlong ;external ProjDll Name
'pj_is_latlong';</FONT></DIV>
<DIV><FONT face=Arial size=2> </DIV></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2>But I meet some trouble</FONT> <FONT
face=Arial size=2>:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>1:pj_errno make an exception "Access
Violation" in any case;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>2:I can not find the excatly definition of PJ*,so i
can not use pj_free(),that will cause a memory leak .</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>3:pj_fwd will raise stack overflow in the case of
the code below:</FONT></DIV>
<DIV><FONT face=Arial size=2>procedure TForm2.Button1Click(Sender:
TObject);<BR>var<BR> P:projPJ;<BR> errorno:Integer;<BR>
temp:XY;<BR> temp1:XY;<BR> nu:Cardinal;<BR>
i:Integer;<BR>begin<BR> P:=pj_init_plus(PChar(' +proj=utm +zone=11
+ellps=WGS84));</FONT></DIV>
<DIV><FONT face=Arial size=2> i:=pj_errno;<BR>
temp.X:=0;temp.Y:=0;<BR> nu:=GetTickCount;<BR> for i:=0
to 50000 do<BR> temp1:=pj_inv(temp,P);<BR>
ShowMessage(IntToStr(GetTickCount-nu));</FONT></DIV>
<DIV><FONT face=Arial size=2>end;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>if i<40000 there is no problem</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><A
href="mailto:Bornkilled@21cn.com">Bornkilled@21cn.com</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>