Announcement

Collapse
No announcement yet.

Declare in DLL does not work

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Declare in DLL does not work

    Hi

    Im having a unexpected problem calling a DLL from PB.
    The DLL is provided by the copy protection company eAladdin
    and calls for HASP routines.
    My code:

    DECLARE SUB Hasp BDECL LIB "HASPVB32.DLL" (BYVAL Service AS LONG, BYVAL seed AS LONG,BYVAL lpt AS LONG,BYVAL pass1 AS LONG,BYVAL pass2 AS LONG, retcode1 AS LONG, retcode2 AS LONG, retcode3 AS LONG, retcode4 AS ANY)
    FUNCTION Check_Hasp() AS INTEGER
    DIM P1 AS LONG, P2 AS LONG, P3 AS LONG, P4 AS LONG
    DIM TP1 AS LONG, TP2 AS LONG, TP3 AS LONG, TP4 AS LONG, TP5 AS LONG
    TP1=1
    TP2=0
    TP3=0
    TP4=1234
    TP5=1234
    CALL Hasp(tp1,tp2,tp3,tp4,tp5, P1, P2, P3, P4)
    END FUNCTION
    FUNCTION DOSOME() Export as integer
    Function=1
    END FUNCTION

    It does not mather wheter I call Check_Hasp or DOSOME, which means not referencing Check_Hasp,
    the DLL won't start and gives a File not found Error.
    As soon as the Call Hasp function is disabled everything works fine...

    No need to say my prototype in VB works fine.

    Thanks

    Eric Kelderman


    ------------------
    Eric Kelderman
    www.dlog.nl

  • #2
    You probably need to add:
    Code:
    ALIAS "Hasp"
    to the DECLARE statement, to overcome inconsistencies in case-sensitive
    interpretation of the function name in the various modules.

    Regards, Simon

    [This message has been edited by Simon Morgan (edited August 06, 2001).]

    Comment


    • #3
      You probably don't want BDECL. You probably do want an ALIAS clause. Try this:
      Code:
      DECLARE SUB Hasp LIB "HASPVB32.DLL" ALIAS "Hasp" (BYVAL Service AS LONG, _
         BYVAL seed AS LONG, BYVAL lpt AS LONG, BYVAL pass1 AS LONG, BYVAL pass2 AS LONG, _
         retcode1 AS LONG, retcode2 AS LONG, retcode3 AS LONG, retcode4 AS ANY)
      ------------------
      Tom Hanlin
      PowerBASIC Staff

      Comment


      • #4


        Works, turned out to be a all lowercase "hasp" aslias and no BDECL.

        Thanks!

        Eric


        ------------------
        Eric Kelderman
        www.dlog.nl

        Comment

        Working...
        X