[OSRS-PROJ] proj.4 in VB

Alexander Weidauer alex.weidauer at huckfinn.de
Fri Jun 27 06:56:46 EDT 2003


Hi Thomas but if you use the  _cdecl it should work
here a code snippet from my API

Function  _pj_init_plus_path(const Args: PChar; const Path: PChar):
           PProjPJ ;cdecl;external LibName;

{ forward projection normally Longitude Latitude to plain xy Coordinates }
Function  _pj_fwd(ProjLP:TProjLP; projPJ:PProjPJ):TProjXY;
           cdecl;external LibName;

{ inverse projection normally plain xy coordinates to longitude latitude 
coordinates }
Function  _pj_inv(ProjXY:TProjXY; projPJ:PProjPJ):TProjLP;
           cdecl;external LibName;

Bye Alex


Thomas Flemming schrieb:
> Hello,
> 
> the main problem is, that the proj.dll is not usable by VB because of 
> the function declarations. They have to be declared with __stdcall.
> So not:
>   void pr_xxx(..);
> but:
>   #include <windows.h>    
>   void __stdcall pr_xxx(..);
> 
> Then it should work.
> Thomas
> 
> 
> 
> For more details in this see
> 
> Christopher Pouliot schrieb:
> 
>> Hello,
>>
>> I have downloaded the proj.dll file (v4.4.6) and am trying
>> unsuccessfully to use it in Visual Basic.  The simple initialization
>> code below causes a fatal error in VB and crashes the program.  My
>> experience working with external DLLs is limited so any assistance or
>> sample VB code would be greatly appreciated.
>>
>> Private Declare Function pj_init Lib "c:\software\proj\bin\proj.dll"
>> (ByVal argc As Integer, ByRef argv() As String) As String
>>
>> Private Sub Command1_Click()
>>   Dim anArr(2) As String
>>   Dim aResponse As String
>>     anArr(0) = "proj=utm"
>>   anArr(1) = "zone=11"
>>   anArr(2) = "ellps=GRS80"
>>     aResponse = pj_init(3, anArr)
>> End Sub
>>
>>
>> Thank you,
>>
>> Chris
>> ----------------------------------------
>> PROJ.4 Discussion List
>> See http://www.remotesensing.org/proj for subscription, unsubscription
>> and other information.
>>
> 


----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.



More information about the Proj mailing list