Announcement

Collapse
No announcement yet.

Generate DLL and use DLL in PowerBasic

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

  • Generate DLL and use DLL in PowerBasic

    Hi...
    I need to generate a DLL for use in Delphi. Is it possible?
    This DLL must acess Winhttp.DLL, Msxml.DLL and CAPICOM.DLL. Is it possible too?
    Thanks.

  • #2
    Originally posted by Pedro Caetano Barbiero View Post
    Hi...
    I need to generate a DLL for use in Delphi. Is it possible?
    Sure. Since with PB/Win you can create standard .DLL, it's just a matter of using the right / corresponding datatypes & calling convention.

    I have been recently in a similar situation: created a .DLL in PB and provided some demo code using it from various languages. If it can be of some help, you can maybe compare the PowerBASIC and & Delphi declarations / samples from the sample's package here: TrIDLib.

    Bye!
    -- The universe tends toward maximum irony. Don't push it.

    File Extension Seeker - Metasearch engine for file extensions / file types
    Online TrID file identifier | TrIDLib - Identify thousands of file formats

    Comment


    • #3
      This DLL must acess Winhttp.DLL, Msxml.DLL and CAPICOM.DLL. Is it possible too?
      If your DLL imports any function in any other DLL (DECLARE ...LIB "Dllname.dll"...) , if that DLL is not available at runtime and not yet loaded in the address space of the calling process, then the load of DLL (either at program start or on explicit call to LoadLibrary) fails; and if it's a good day and the calling process is using an explicit call to LoadLibrary, the error code returned by GetLastError will tell you the load failed due to a missing import.

      To take full advantage of this, you "could" make all your calls from functions in the DLL using LoadLibrary(); that way your DLL would always load into the calling process when that process starts even if one or more of the named DLLs is absent. This mght be a good plan if you are planning on distributing the DLL as a standalone product, because now every function called by the user could return an error code for missing import. But this is probably not a good idea if this DLL is part of a larger application... in this case the user would more than likely rather be notified immediately when the program starts that something is missing and the application is not going to be able to do all the things it was designed to do.

      FWIW, a handy function for you might be the WinApi "SearchPath" function. It will let you check - without loading - any DLL to see if Windows is going to find it when asked to load it later.

      MCM
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment

      Working...
      X