Announcement

Collapse
No announcement yet.

Pre defining

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

  • Pre defining

    I have a situation now....

    I just finished my CCSREG.DLL which creates, checks, verifies registration numbers for shareware (it's crackable but works like a car door lock, keeps honest people out)...

    Now, I separately created a .INC file for all of the calls I make in the DLL.
    The DLL is 100% separate from my COMMON DLL's I used, except I cut and pasted some functions from my date DLL and my common DLL.


    With thesame name I get a duplicate definition issue, except i"m calling a different Lib.

    Example:

    Declare Function One Lib "CCS.DLL"(two as string) as long
    Declare Function Two Lib "CCSREG.DLL"(two as string) as long

    Is there a way to avoid this or do I have to change the function names? (I hope not)...

    I'm wondering if $IF DEF or something like that can help me out since I never really used them before...


    Thanks,

    Scott



    -------------
    Scott
    mailto:[email protected][email protected]</A>
    MCSE, MCP+Internet
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    Originally posted by Scott Turchin:
    Is there a way to avoid this or do I have to change the function names? (I hope not)...
    Scott, just use ALIAS in the prototype. See the "FUNCTION/END FUNCTION statements" in the help file.



    ------------------
    Troy King
    [email protected]
    Troy King
    katravax at yahoo dot com

    Comment


    • #3
      Scott --

      > works like a car door lock,
      > keeps honest people out

      Where I come from, the honest people out won't steal your car even if the door is wide open and the engine is running. You must come from a really rough neighborhood.

      If I understand what you're asking, you have two functions with identical names in two different DLLs, and both DLLs are used by the same program. (Right?) That's not a problem, but no single program can DECLARE the function as existing in two places at once, or the compiler wouldn't know which one to use. Even though you know that the functions are identical, you're asking the compiler to toss a coin and pick the right one.

      The cleanest solution would be to remove the function from one of the DLLs, and tell the DLL to look for the function in the other DLL (by using a DECLARE in the DLL).

      Or put the common function in its own DLL, and have both of the other DLLs call it from there.

      Or, if the duplicate function is only called "internally" by one DLL, make it a PRIVATE function and remove its declaration from the INC file. The DLL will still be able to call it, but it will be invisible to the EXE and other DLLs.

      You could use conditional compilation to split up the DECLAREs, but it would probably get pretty messy. #IF %DEF can be used only with equates, not functions, so you would have to set up a system of equates, and then use #IF or #IF %DEF to tell the compiler which DECLAREs to use... Yuck!

      -- Eric



      ------------------
      Perfect Sync: Perfect Sync Development Tools
      Email: mailto:[email protected][email protected]</A>

      "Not my circus, not my monkeys."

      Comment


      • #4
        Hi Scott

        this is why I always use prefixes in my modules. For example if I've got a module called cgienc.bas then I'll prefix all subs, functions and equates with "cgienc_". Not everyone's cup of tea but it works for me and forces me to think about encapsulation.
        YMMV

        Cheers

        Florent


        ------------------

        Comment


        • #5
          If I understand you correctly,
          You have two diffrent DLL's 'CCSDLL.DLL' and 'CCREG.DLL'
          In both DLL's you have identical function-names
          Your CCREG.DLL calls 'CCSDLL.DLL" so you #include 'CCSDLL.INC'
          When you compile your CCREG.DLL you get duplicate definition.
          The obvious sulotion is to rem out the declaration you don't need, that is the one in CCSDLL.INC
          I have had this situation many times during partitial testing of code, without getting duplicate
          definitions so this is probably not your problem..
          ----
          If it is like Eric Pearson supposed, that you get the duplicate definition-error when compiling an app, that uses both DLL-s
          I suggest that you explicit loads your 'CCSREG.DLL' with LoadLibrary and use getProcAddress
          as you probably only need this DLL during application startup
          and it is a small set of functions to call.
          This way you don't need 'CCSREG.INC' and won't get duplicate
          definitions.


          ------------------
          Fred
          mailto:[email protected][email protected]</A>
          http://www.oxenby.se



          [This message has been edited by Fred Oxenby (edited June 13, 2000).]
          Fred
          mailto:[email protected][email protected]</A>
          http://www.oxenby.se

          Comment


          • #6
            Problem resolved LOL


            I removed the CCSREG declarations that were not necessary, some were internal anyway to the DLL, that's the only reaso nI put them in there rather than being dependent on CCS.DLL.
            This way I can send anyone the DLL and they won't require my CCS.DLL but can use CCSREG.DLL


            By the way the DLL works flawlessly, anyone interested in putting an evaluation limit on their software email me and I'll send the DLL and a readme (WOrking on that tomorrow though, give me a few days since Winlog For Windows 2000 is releasing shortly)..


            Thanks all!


            PS, can someone give me an alias example inside the .BAS file?

            Ie, if someone wants to use my DLL from VB or VC++ ??


            Thanks, ps I'm thinking like this:

            Function One alias "One"(x as long) as long


            Scott

            ------------------
            Scott
            mailto:[email protected][email protected]</A>
            MCSE, MCP+Internet
            Scott Turchin
            MCSE, MCP+I
            http://www.tngbbs.com
            ----------------------
            True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

            Comment


            • #7
              > works like a car door lock,
              > keeps honest people out

              Where I come from, the honest people out won't steal your car even if the door is wide open and the engine is running. You must come from a really rough neighborhood.
              Actually for themost part, other than a few car break-in's I live a very safe neighborhood.
              It's when I'm at work in Seattle/Bellevue that I worry! LOL

              That DLL situation is resolved and released as sharware now!
              I'll write the doc up and release CCSREG.DLL for anyone interested in limiting evaluation software.






              ------------------
              Scott
              mailto:[email protected][email protected]</A>
              MCSE, MCP+Internet
              Scott Turchin
              MCSE, MCP+I
              http://www.tngbbs.com
              ----------------------
              True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

              Comment

              Working...
              X