in reply to Cant call method : win32::API

Start by changing
my $iAddNum = Win32::API->new('Arithmetic','addNumbers','NN','N');
to
my $iAddNum = Win32::API->new('Arithmetic','addNumbers','NN','N') or die("dll import: $^E\n");

Replies are listed 'Best First'.
Re^2: Cant call method : win32::API
by rjshek (Initiate) on Sep 15, 2009 at 07:01 UTC
    I made the changes you suggested, now I getting error "the specfied procedure could not be found"...Please help
      "the specfied procedure could not be found"

      The dll is being found ok, but the function you're calling could not be found. I'm guessing that's either because the function is not exported by the dll, or it doesn't use the stdcall convention.

      Update: Can you tell us how the dll was built ? (That might help.)

      Cheers,
      Rob
        here is the code.. VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "Maths" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Public Function addNumbers(lNum1 As Long, lNum2 As Long) As Long addNumbers = lNum1 + lNum2 End Function Public Function multiplyNumbers(lNum1 As Long, lNum2 As Long) As Long multiplyNumbers = lNum1 * lNum2 End Function Public Function subtractNumbers(lNum1 As Long, lNum2 As Long) As Long subtractNumbers = lNum1 - lNum2 End Function Public Function divideNumbers(lNum1 As Long, lNum2 As Long) As Long divideNumbers = lNum1 / lNum2 End Function