Accessing a DLL

  • Hello,

    I have a DLL written in C. How can I access its methods and attributes from the sql code? I am using SQL Server.

    I would appreciate as much detail as possible, since I am a total newb in this matter, but nay help at alçl would be appreciated.

    Thanks in advance,

    Marcelo

  • This was removed by the editor as SPAM

  • Questions -

    • When you say 'written in C' do you mean C++ or C compiled with Visual C++?  The reason I ask is that C-based DLLs don't have 'attributes' or 'methods', they just have functions.

    • Do you have access to the source?

    • Do you have access to VB?

    I have interacted with DLLs in TSQL in a couple of ways.  Using the 'standard' way, the DLLs MUST be COM (OLE Automation) libraries.  Generally these are written in C++, VB, Delphi (among others).  You ineract with the objects defined in the library using the sp_OAxxx procs.  From BOL:

    To create an OLE Automation object

    1. Call sp_OACreate to create the object.
    2. Use the object.

      • Call sp_OAGetProperty to get a property value.
      • Call sp_OASetProperty to set a property to a new value.
      • Call sp_OAMethod to call a method.
      • Call sp_OAGetErrorInfo to get the most recent error information.

    3. Call sp_OADestroy to destroy the object.

    Note  All of these steps must be performed within a single Transact-SQL statement batch. All created OLE objects are destroyed automatically at the end of each statement batch.

     

     

    If the library is NOT a COM library, you can make it one given some knowledge (and access to) Visual Basic.


    -------
    at us, very deafly, a most stares
    collosal hoax of clocks and calendars

    eecummings

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply