Results 1 to 3 of 3

Thread: Please tell me how to make DLLs?

  1. #1

    Thread Starter
    Fanatic Member jian2587's Avatar
    Join Date
    Aug 2000
    Location
    I bet u need a fusion powered shuttle to reach my place...
    Posts
    963

    Question

    I want to create some new functions and put it in a DLL
    then declare it and use it.
    But How?
    I tried this...Man I am stupid
    (I open a new DLL project)
    sub abc
    msgbox "abc123"
    end sub
    'module
    public declare function abc()

    'After compile to DLL i use it like this
    public declare sub abc lib "c:\abc.dll" ()

    Private Sub Command1_click()
    abc
    end sub
    But it keep on display an error
    Could anyone tell me how to make a DLL?
    ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
    Programming is fun, but only if you're not on a tight deadline
    So I consider all those working engineers sad people

    VB FTP class
    3 page PHP crash course
    Crash Course on DX9 Managed with VB.NET covering basics till terrain creation

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Jian, As for Visual Basic, it only can produce 2 type of DLL. That call Active DLL(In process) and Avtive EXE (Out of Process).

    Both must be include in the Project|References and can not declara as the normal Library Type DLL that compile from C/C++.

    The following is the way to declare a Active DLL.
    Sample
    Code:
    Option Explicit
    Dim Obj As Class1
    
    Private Sub Form_Load()
       'Create a new instance of the Object (DLL)
       Set Obj = New Class1
    End Sub
    
    Private Sub Form_Unload()
       'Destroy the Object (DLL)
       Set Obj = Nothing
    End Sub

    As from your sample, you no need to have a Basic Module file in you DLL project folder. "coz Basic Module normally juz use to declara the API function or some public variable.

    Code:
    'In your Class Module
    Public Sub abc() 
       msgbox "abc123" 
    End Sub
    Code:
    'In your Form
    Option Explicit
    Dim Obj As Class1
    
    Private Sub Command1_Click()
       Set Obj = New Class1
       Obj.abc 
       Set Obj = Nothing
    End sub
    Well, hope this made sense to you.


  3. #3

    Thread Starter
    Fanatic Member jian2587's Avatar
    Join Date
    Aug 2000
    Location
    I bet u need a fusion powered shuttle to reach my place...
    Posts
    963

    Smile

    Thanks for your RE anyway.
    But I really wanna know how to make a DLL to be invoked by other progs.
    ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
    Programming is fun, but only if you're not on a tight deadline
    So I consider all those working engineers sad people

    VB FTP class
    3 page PHP crash course
    Crash Course on DX9 Managed with VB.NET covering basics till terrain creation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width