While I've worked plenty in perl I've never had to connect to/use a DLL. 
GoldMine's API uses a DLL.  While of course they have plenty of docs for VB 
and C++, they have none for perl.

Below is their VB declarations file.  How can I convert this to perl and 
then get access to the DLL's core functions & methods?

Cheers,
Paul ---

VB declarations file...

Attribute VB_Name = "GM6S32Main"
' ***************************************************************
' *
' * Module Name : GMDeclare
' * Purpose   : VB declarations for gm6s32.dll functions
' * Author    : Calvin Luttrell, Nelson Fernandez
' * Revised   : George Hayes
' * Created   : 06/15/1999
' * Updated   : 10/27/1999
' * Updated   : 11/4/2000
' ****************************************************************
Option Explicit

'licensing structure passed to GMW_GetLicenseInfo
Public Type GMW_LicInfo
    Licensee As String * 60         'licensee name
    LicNo As String * 20            'master serial number
    SiteName As String * 20         'undocked site name
    LicUsers As Long                'licensed users
    SQLUsers As Long                'licensed SQL users
    GSSites  As Long                'licensed GoldSync sites
    IsDemo As Long                  'is demo install
    IsServerLic As Long             'is primary license ('D' or 'E')
    IsRemoteLic  As Long            'is remote license ('U' or 'S')
    ISUSALic As Long                'is USA license (1=US,128/32 bit, 
0=nonUS, 32-bit only)
    iDLLVersion As Long             'the DLL version (400822)
    iReserved1 As Long
    iReserved2 As Long
    sReserved As String * 100
End Type

Public Type GMWStr                   'LPSTR return value from API calls
    Ptr As Long                  'Use GMString(GMWStr) to obtain the string 
data
End Type

'DLL intialization functions
Public Declare Function GMW_LoadBDE Lib "gm6s32.dll" (ByVal strSysDir As 
String, _
                                                      ByVal strGoldDir As 
String, _
                                                      ByVal strCommonDir As 
String, _
                                                      ByVal strUser As 
String, _
                                                      ByVal strPassword As 
String) As Long

Public Declare Function GMW_UnloadBDE Lib "gm6s32.dll" () As Long

Public Declare Function GMW_Login Lib "gm6s32.dll" (ByVal strUser As String, 
_
                                                    ByVal strPassword As 
String, _
                                                    Optional ByVal 
strSQLUser As String, _
                                                    Optional ByVal 
strSQLPassword As String) As Long

Public Declare Function GMW_Logout Lib "gm6s32.dll" () As Long

Public Declare Function GMW_MULogin Lib "gm6s32.dll" (ByVal strUser As 
String, _
                                                      ByVal strPassword As 
String, _
                                                      ByVal strSQLUser As 
String, _
                                                      ByVal strSQLPassword 
As String, _
                                                      ByVal strCommonDir As 
String) As Long

Public Declare Function GMW_MULogout Lib "gm6s32.dll" (ByVal nSessionID As 
Long) As Long

Public Declare Function GMW_MUBeginSession Lib "gm6s32.dll" (ByVal 
nSessionID As Long) As Long

Public Declare Function GMW_SetSQLUserPass Lib "gm6s32.dll" (ByVal 
strUserName As String, _
                                                             ByVal 
strPassword As String) As Long

Public Declare Function GMW_GetLicenseInfo Lib "gm6s32.dll" (LicInfo As 
GMW_LicInfo) As Long


' Datastream functions
Public Declare Function GMW_DS_Query Lib "gm6s32.dll" (ByVal strSQL As 
String, _
                                                       ByVal strFilter As 
String, _
                                                       ByVal strFDlm As 
String, _
                                                       ByVal strRDlm As 
String) As Long

Public Declare Function GMW_DS_Range Lib "gm6s32.dll" (ByVal strTable As 
String, _
                                                       ByVal strTag As 
String, _
                                                       ByVal strTopLimit As 
String, _
                                                       ByVal strBotLimit As 
String, _
                                                       ByVal strFields As 
String, _
                                                       ByVal strFilter As 
String, _
                                                       ByVal strFDlm As 
String, _
                                                       ByVal strRDlm As 
String) As Long

Public Declare Function GMW_DS_Fetch Lib "gm6s32.dll" (ByVal iHandle As 
Long, _
                                                       ByVal strbuf As 
String, _
                                                       ByVal iBufSize As 
Long, _
                                                       ByVal nGetRecs As 
Long) As Long

Public Declare Function GMW_DS_Close Lib "gm6s32.dll" (ByVal iHandle As 
Long) As Long

'DataStream SQL query & fetch wrapper
Public Declare Function GMW_SQLStream Lib "gm6s32.dll" (ByVal szSQL As 
String, _
                                                        ByVal szFilter As 
String, _
                                                        ByVal nStartRec As 
Long, _
                                                        ByVal nGetRecs As 
Long, _
                                                        ByVal szBuf As 
String, _
                                                        ByVal iBufSize As 
Long, _
                                                        ByVal szFDlm As 
String, _
                                                        ByVal szRDlm As 
String) As Long

'DBF workarea functions
Public Declare Function GMW_DB_Open Lib "gm6s32.dll" (ByVal strTableName As 
String) As Long

Public Declare Function GMW_DB_Close Lib "gm6s32.dll" (ByVal lArea As Long) 
As Long

Public Declare Function GMW_DB_Append Lib "gm6s32.dll" (ByVal lArea As Long, 
_
                                                        ByVal strRecID As 
String) As Long

Public Declare Function GMW_DB_Replace Lib "gm6s32.dll" (ByVal lArea As 
Long, _
                                                         ByVal strField As 
String, _
                                                         ByVal strData As 
String, _
                                                         ByVal iAddTo As 
Long) As Long

Public Declare Function GMW_DB_Delete Lib "gm6s32.dll" (ByVal lArea As Long) 
As Long

Public Declare Function GMW_DB_Unlock Lib "gm6s32.dll" (ByVal lArea As Long) 
As Long

Public Declare Function GMW_DB_Read Lib "gm6s32.dll" (ByVal lArea As Long, _
                                                      ByVal strField As 
String, _
                                                      ByVal strbuf As 
String, _
                                                      ByVal lBufSize As 
Long) As Long

Public Declare Function GMW_DB_Top Lib "gm6s32.dll" (ByVal lArea As Long) As 
Long

Public Declare Function GMW_DB_Bottom Lib "gm6s32.dll" (ByVal lArea As Long) 
As Long

Public Declare Function GMW_DB_SetOrder Lib "gm6s32.dll" (ByVal lArea As 
Long, _
                                                          ByVal strTag As 
String) As Long

Public Declare Function GMW_DB_Seek Lib "gm6s32.dll" (ByVal lArea As Long, _
                                                      ByVal strParam As 
String) As Long

Public Declare Function GMW_DB_Skip Lib "gm6s32.dll" (ByVal lArea As Long, _
                                                      ByVal lSkip As Long) 
As Long

Public Declare Function GMW_DB_Goto Lib "gm6s32.dll" (ByVal lArea As Long, _
                                                      ByVal strRecNo As 
String) As Long

Public Declare Function GMW_DB_Move Lib "gm6s32.dll" (ByVal lArea As Long, _
                                                      ByVal strCommand As 
String, _
                                                      ByVal strParam As 
String) As Long

Public Declare Function GMW_DB_Search Lib "gm6s32.dll" (ByVal lArea As Long, 
_
                                                        ByVal strExpr As 
String, _
                                                        ByVal strRecID As 
String) As Long

Public Declare Function GMW_DB_Filter Lib "gm6s32.dll" (ByVal lArea As Long, 
_
                                                        ByVal strFilterExpr 
As String) As Long

Public Declare Function GMW_DB_Range Lib "gm6s32.dll" (ByVal lArea As Long, 
_
                                                       ByVal strMin As 
String, _
                                                       ByVal strMax As 
String, _
                                                       ByVal strTag As 
String) As Long

Public Declare Function GMW_DB_RecNo Lib "gm6s32.dll" (ByVal lArea As Long, 
_
                                                       ByVal strRecID As 
String) As Long

Public Declare Function GMW_DB_IsSQL Lib "gm6s32.dll" (ByVal lArea As Long) 
As Long

'Quick one-field access functions (these are slow -- do not use in loops)
Public Declare Function GMW_DB_QuickSeek Lib "gm6s32.dll" (ByVal 
strTableName As String, _
                                                           ByVal strIndex As 
String, _
                                                           ByVal 
strSeekValue As String, _
                                                           ByVal strRecID As 
String) As Long

Public Declare Function GMW_DB_QuickRead Lib "gm6s32.dll" (ByVal 
strTableName As String, _
                                                           ByVal strRecID As 
String, _
                                                           ByVal strField As 
String, _
                                                           ByVal strValue As 
String, _
                                                           ByVal iLen As 
Long) As Long

Public Declare Function GMW_DB_QuickReplace Lib "gm6s32.dll" (ByVal 
strTableName As String, _
                                                              ByVal strRecID 
As String, _
                                                              ByVal strField 
As String, _
                                                              ByVal strValue 
As String, _
                                                              ByVal iAddTo 
As Integer) As Long

'Sync functions
Public Declare Function GMW_SyncStamp Lib "gm6s32.dll" (ByVal strStamp As 
String, _
                                                        ByVal strOutBuf As 
String) As Long

Public Declare Function GMW_UpdateSyncLog Lib "gm6s32.dll" (ByVal strTable 
As String, _
                                                            ByVal strRecID 
As String, _
                                                            ByVal strField 
As String, _
                                                            ByVal strAction 
As String) As Long

Public Declare Function GMW_ReadImpTLog Lib "gm6s32.dll" (ByVal strFile As 
String, _
                                                          ByVal lDelWhenDone 
As Long, _
                                                          ByVal strStatus As 
String) As Long

Public Declare Function GMW_NewRecID Lib "gm6s32.dll" (ByVal strRecID As 
String, _
                                                       ByVal strUser As 
String) As GMWStr


'WinAPI
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Dest As 
Any, Src As Any, ByVal Length As Long)
Public Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal 
gmstrptr As Long) As Long

 
'*********************************************************************************
 '*      Copyright (c) 1999 GoldMine Software Corporation '* '*      Version 
1.0:   April 14, 1999 '*      Programmer :   David Yanai '*      VB Revision:   
George Hayes '*      Revised:       November 5, 2000 '* '*      Purpose: '*     
         Visual Basic interface for GoldMine name value container '* '*      
Example: '* '*  Sub displayField(hgmnv as Long, strFldName as String) '*     
dim strDefault as string, strValue as string, count as long, i aslong '* '*     
count = GMW_NV_GetMultiValueCount(hgmnv, strFldName) '*     If count <= 0 Then 
exit sub '* '*     strValue = GMString(GMW_NV_GetValue(hgmnv, strFldName, 
strDefault)) '*     debug.print strFldName, strValue '* '*     For i = 2 to 
count '*        strValue = GMString(GMW_NV_GetMultiValue(hgmnv, strFldName, 
i,strDefault)) '*        debug.print , strValue '*     next i '* '*  End Sub '* 
'**************************************************
 *******************************'gm6s32.dll business logic functionsPublic 
Declare Function GMW_Execute Lib "gm6s32.dll" (ByVal strFuncName AsString, 
ByVal hgmnv As Any) As Long'create , release & copy name value containersPublic 
Declare Function GMW_NV_Create Lib "gm6s32.dll" () As LongPublic Declare 
Function GMW_NV_CreateCopy Lib "gm6s32.dll" (ByVal hgmnv AsLong) As LongPublic 
Declare Sub GMW_NV_Delete Lib "gm6s32.dll" (ByVal hgmnv As Long)Public Declare 
Sub GMW_NV_Copy Lib "gm6s32.dll" (ByVal hgmnvDestination AsLong, ByVal 
hgmnvSource As Long)'value typePublic Enum GMWNVValueType    
GMW_NV_VALUE_TYPE_NO_NAME& = 0    GMW_NV_VALUE_TYPE_SINGLE_STRING& = 1    
GMW_NV_VALUE_TYPE_MULTI_STRING& = 2    GMW_NV_Value_Type_Single_NV& = 3    
GMW_NV_VALUE_TYPE_MULTI_NV& = 4End EnumPublic Declare Function 
GMW_NV_GetValueType Lib "gm6s32.dll" (ByVal hgmnv AsLong, ByVal strName As 
String) As GMWNVValueType'get and set by namePublic Declare Function 
GMW_NV_GetValue Lib "gm6s32.dll" (ByVal h
 gmnv AsLong, _                                                          ByVal 
strName AsString, _                                                          
ByValstrDefaultValue As String) As GMWStrPublic Declare Sub GMW_NV_SetValue Lib 
"gm6s32.dll" (ByVal hgmnv As Long, _                                            
         ByVal strName AsString, _                                              
       ByVal strValue AsString)Public Declare Function GMW_NV_GetNvValue Lib 
"gm6s32.dll" (ByVal hgmnv AsLong, ByVal strName As String) As LongPublic 
Declare Sub GMW_NV_SetNvValue Lib "gm6s32.dll" (ByVal hgmnv As Long,_           
                                            ByVal strName AsString, _           
                                            ByVal hgmnvValue AsLong)Public 
Declare Function GMW_NV_SetEmptyNvValue Lib "gm6s32.dll" (ByVal hgmnvAs Long, 
ByVal strName As String) As Long 'add a empty nv and retuns it tobe filled buy 
caller'       GMW_NV_SetStr'       Set one or more n
 ame value pairs''       strDlmName   :  Delimiter between name and value'      
 strDlmVal    :  Delimiter between different name value pairs'       strData    
  :  string with name value pairs''       strDlmVal & strDlmVal can be the same 
value''       Example:'              GMW_NV_SetStr(hgmnv, "=", 
";","COMPANY=GoldMine;CONTACT=Wilson")'              GMW_NV_SetStr(hgmnv, "&", 
"&","COMPANY&GoldMine&CONTACT&Wilson")Public Declare Sub GMW_NV_SetStr Lib 
"gm6s32.dll" (ByVal hgmnv As Long, _                                            
       ByVal strDlmName AsString, _                                             
      ByVal strDlmVal AsString, _                                               
    ByVal strData As String) 'Check if value exists 'return : 0 failed,  1 
successesPublic Declare Function GMW_NV_NameExists Lib "gm6s32.dll" (ByVal 
hgmnv AsLong, ByVal strName As String) As Long 'Remove valuesPublic Declare Sub 
GMW_NV_EraseName Lib "gm6s32.dll" (ByVal hgmnv As Long,ByVal st
 rName As String)Public Declare Sub GMW_NV_EraseAll Lib "gm6s32.dll" (ByVal 
hgmnv As Long) 'Iterate over list one basedPublic Declare Function GMW_NV_Count 
Lib "gm6s32.dll" (ByVal hgmnv As Long)As LongPublic Declare Function 
GMW_NV_GetValueTypeFromIndex Lib "gm6s32.dll" (ByValhgmnv As Long, ByVal index 
As Long) As LongPublic Declare Function GMW_NV_GetNameFromIndex Lib 
"gm6s32.dll" (ByValhgmnv As Long, ByVal index As Long) As GMWStrPublic Declare 
Function GMW_NV_GetValueFromIndex Lib "gm6s32.dll" (ByValhgmnv As Long, ByVal 
index As Long) As GMWStr 'Multiple values per name handling 'Get number of 
values for a namePublic Declare Function GMW_NV_GetMultiValueCount Lib 
"gm6s32.dll" (ByValhgmnv As Long, ByVal strName As String) As Long 'Get the 
n'th one based value of a multi value pairPublic Declare Function 
GMW_NV_GetMultiValue Lib "gm6s32.dll" (ByVal hgmnvAs Long, _                    
                                           ByVal strNameAs String, _            
             
                                       n As Long, _                             
                                  ByValstrDefaultValue As String) As GMWStr '1 
basedPublic Declare Function GMW_NV_GetMultiNvValue Lib "gm6s32.dll" (ByVal 
hgmnvAs Long, _                                                                 
ByValstrName As String, _                                                       
          ByVal n AsLong) As Long '1 based 'Append a multi value. return's the 
number of multi valuesPublic Declare Function GMW_NV_AppendValue Lib 
"gm6s32.dll" (ByVal hgmnv AsLong, _                                             
                ByVal strNameAs String, _                                       
                      ByVal strValueAs String) As Long'append a copy of value 
ownership of value does not changePublic Declare Function GMW_NV_AppendNvValue 
Lib "gm6s32.dll" (ByVal hgmnvAs Long, _                                         
                      ByVal strNameAs String, _   
                                                             ByValhgmnvValue As 
Long) As LongPublic Declare Function GMW_NV_AppendEmptyNvValue Lib "gm6s32.dll" 
(ByValhgmnv As Long, ByVal strName As String) As Long ' appends a empty NV 
valueand retuns it to be filled 'getting the parent and the root of a 
HGMNVPublic Declare Function GMW_NV_GetRoot Lib "gm6s32.dll" (ByVal hgmnv 
AsLong) As LongPublic Declare Function GMW_NV_GetParent Lib "gm6s32.dll" (ByVal 
hgmnv AsLong) As LongPublic Declare Function GMW_NV_IsRoot Lib "gm6s32.dll" 
(ByVal hgmnv As Long)As Long ' you cant test : hgmnv == 
GMW_NV_GetRoot(hgmnv);'helper functions values are stored as strings this 
function just translateto and fromPublic Declare Sub GMW_NV_SetInt Lib 
"gm6s32.dll" Alias "GMW_NV_SetIntValue"(ByVal hgmnv As Long, _                  
                                                            ByVal strName As 
String, _                                                                       
       ByVal Valu
 e As Long)Public Declare Sub GMW_NV_AppendInt Lib "gm6s32.dll" 
Alias"GMW_NV_AppendIntValue" (ByVal hgmnv As Long, _                            
                                                        ByVal strName As 
String, _                                                                       
             ByVal Value As Long)Public Declare Function GMW_NV_GetInt Lib 
"gm6s32.dll" Alias"GMW_NV_GetIntValue" (ByVal hgmnv As Long, _                  
                                                                 ByVal strName 
As String, _                                                                    
               ByVal defValue As Long) As LongPublic Declare Function 
GMW_NV_GetIntMulti Lib "gm6s32.dll" Alias"GMW_NV_GetIntMultiValue" (ByVal hgmnv 
As Long, _                                                                      
                       ByVal strName As String, _                               
                                                              ByVal d
 efValue As Long) As Long '1 based'These Boolean helper functions should not be 
called directly. Use theequivalent wrapper functions'in the declarations 
section of this module for safe type-castingPublic Declare Sub GMW_NV_SetBool 
Lib "gm6s32.dll" Alias"GMW_NV_SetBoolValue"
ByVal hgmnv As Long, _                                                          
                      ByVal strName As String, _                                
                                                ByVal Value As Long)Public 
Declare Sub GMW_NV_AppendBool Lib "gm6s32.dll" Alias"GMW_NV_AppendBoolValue" 
(ByVal hgmnv As Long, _                                                         
                             ByVal strName As String, _                         
                                                             ByVal Value As 
Long)Public Declare Function GMW_NV_GetBool Lib "gm6s32.dll" 
Alias"GMW_NV_GetBoolValue" (ByVal hgmnv As Long, _                              
                                                       ByVal strName As String, 
_                                                                               
      ByVal defValue As Long) As LongPublic Declare Function 
GMW_NV_GetBoolMulti Lib "gm6s32.dll" Alias"GMW_NV_GetBoolMultiValue" (ByVal hgmn
 v As Long, _                                                                   
                            ByVal strName As String, _                          
                                                                     ByVal 
defValue As Long) As Long '1 based 'A framework for observing action on HGMNV 
(Observer pattern ). 'Currently we only support delete notify 
(GMW_NV_NOTIFY_DELETE) 'An observer can remove himself with a key he gets when 
he attaches to 'If you get the delete notification do not remove yourself as an 
observer.this is done automatically. '  Nonfictions codePublic Enum 
GMWNVNotification    GMW_NV_NOTIFY_NOTHING& = 0    GMW_NV_NOTIFY_DELETE& = 1    
   'The observed HGMNV is being deletedEnd Enum '  [notifyProc]Definition of 
Notification Procedure '              Parameters: '                      hgmnv  
      The NV Container that is notifying theobserver '                      
lNotifyCode  The notify code  (currently onlyGMW_NV_NOTIFY_DELETE) '       
                dwParam      a parameter that was given by theobserver when it 
joined the observer list '                      lObserverKey the key that 
GMW_NV_Observe retuned '  See Declarations Section for NotifyProc Stub '  
Function GMW_NV_Observe '              Attach an observer '              
PARAMETERS: '                      hgmnv      the HGMNV to attach to '          
            notifyProc a callback to call on notification '                     
 dwParam    a DWORD parameter to pass back to thenotification function '        
      RETUN VALUE: '                      an observer Key or 0 on error '       
               Caller must use this key to remove himself fromObserver list 
'Public Declare Function GMW_NV_Observe Lib "gm6s32.dll" (ByVal hgmnv AsLong, _ 
                                                        ByVal NotifyProc 
AsLong, _                                                         ByVal dwParam 
AsLong) As Long  'Returns an observer Key '  Function GMW_NV_
 UnObserve '              Remove from observer list '              PARAMETERS: 
'                      hgmnv        the HGMNV to remove from obsever list '     
                 lObserverKey the key that GMW_NV_Observe retunedPublic Declare 
Sub GMW_NV_UnObserve Lib "gm6s32.dll" (ByVal hgmnv As Long,ByVal lObserverKey 
As Long)Public Sub GMW_NV_SetBoolValue(hgmnv As Long, strName As String, bValue 
AsBoolean)    Call GMW_NV_SetBool(hgmnv, strName, CLng(bValue * -1))End 
SubPublic Function GMW_NV_GetBoolValue(hgmnv As Long, strName As 
String,bdefValue As Boolean) As Boolean    GMW_NV_GetBoolValue = 
CBool(GMW_NV_GetBool(hgmnv, strName,CLng(bdefValue * -1)))End FunctionPublic 
Function GMW_NV_GetBoolMultiValue(hgmnv As Long, strName As String,bdefValue As 
Boolean) As Boolean    GMW_NV_GetBoolMultiValue = 
CBool(GMW_NV_GetBoolMulti(hgmnv, strName,CLng(bdefValue * -1)))End 
FunctionPublic Sub GMW_NV_AppendBoolValue(hgmnv As Long, strName As String, 
bValueAs Boolean)    Call GMW_NV_AppendBo
 ol(hgmnv, strName, CLng(bValue * -1))End SubPublic Function NotifyProc(hgmnv 
As Long, notifycode As GMWNVNotification,dwParam As Long, lKey As Long) As Long 
   'MsgBox "hgmnv - " & hgmnv & ", notifyCode - " & notifycode & ",dwParam - " 
& dwParam    'TODO: Place your Notification Function code in this functionEnd 
FunctionPublic Function GMString(strPtr As GMWStr) As String    Dim strlen As 
Long    strlen = lstrlen(strPtr.Ptr)    If strlen = 0 Then Exit Function    
ReDim strbuf(strlen - 1) As Byte    CopyMemory strbuf(0), ByVal strPtr.Ptr, 
UBound(strbuf) + 1    GMString = StrConv(strbuf, vbUnicode)End Function
---
[This E-mail scanned for viruses by Declude EVA]

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to