Results 1 to 23 of 23

Thread: Exporting functions in VB.NET

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    Cardiff, UK
    Posts
    67

    Exporting functions in VB.NET

    I'm trying to create a DLL in vb.net, only when I try to call the function in the dll, it says the entry point is not found. Obviously this is because I haven't exported the function I'm trying to call - I had the same problem when I started messing with dlls vc.

    Anyway, how do you export a function from in vb .net?

    Thanks

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    how are you declaring and calling this function?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    Cardiff, UK
    Posts
    67
    using a declare statement:

    VB Code:
    1. Declare Sub test Lib "d:\test.dll" (msg As String)

    and then

    VB Code:
    1. test (text1.text)

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    cant do that . .NET dll's are not like API callable dll's. you have to first add a Reference by right clicking the project in the solution explorer and choose Add Reference. Find and check off the appropriate control. Then declare it,

    Dim myobj as New namespace.classname

    then
    myobj.subroutinename.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    Cardiff, UK
    Posts
    67
    Oh right, I'd been told that you could export functions from them so you could use them in that way.

    Ah well, never mind, thx neway

  6. #6
    Addicted Member Vitani's Avatar
    Join Date
    Jul 2001
    Location
    England
    Posts
    134
    So VB.NET DLLs are just like ActiveX DLLs?

    Can you make "normal" DLLs in VB.NET at all?
    If you can dream it, you can do it - Moo Power!

  7. #7
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Someone lied to you.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  8. #8
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Originally posted by Vitani
    So VB.NET DLLs are just like ActiveX DLLs?

    Can you make "normal" DLLs in VB.NET at all?
    No. Still need to use C for that.

    But at least you dont have to register dll's anymore.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  9. #9
    New Member
    Join Date
    Mar 2003
    Location
    USA
    Posts
    10
    I tried this but I keep getting this error

    "File or assembly name myNetAssebly, or one of its dependencies, was not found."


    When I referenced the assembly, I used the browse button to go to exact location where I have the dll.

    Any idea?

    Thanks

  10. #10
    Addicted Member Vitani's Avatar
    Join Date
    Jul 2001
    Location
    England
    Posts
    134
    Originally posted by laptop_01

    "File or assembly name myNetAssebly, or one of its dependencies, was not found."

    Looks like you have a typo int your code, do you not mean myNetAssembly?
    If you can dream it, you can do it - Moo Power!

  11. #11
    New Member
    Join Date
    Mar 2003
    Location
    USA
    Posts
    10
    The typo is in the message I posted. I meant to type MyNetAssembly when I typed out the error message. The code is ok.


    I would appreciate it if you have an idea to how to resolve this problem

  12. #12
    Addicted Member Vitani's Avatar
    Join Date
    Jul 2001
    Location
    England
    Posts
    134
    is this a compile, or run-time error?
    If you can dream it, you can do it - Moo Power!

  13. #13
    New Member
    Join Date
    Mar 2003
    Location
    USA
    Posts
    10
    This is a run time error.

  14. #14
    New Member
    Join Date
    Mar 2003
    Location
    USA
    Posts
    10
    The run time error looks like this:

    Run time error '-2147-24894 (80070002)':

    File or assembly name myNetAssembly, or one of its dependencies, was not found

  15. #15
    Addicted Member Vitani's Avatar
    Join Date
    Jul 2001
    Location
    England
    Posts
    134
    is the DLL in the same folder as the exe that is referencing it?
    If you can dream it, you can do it - Moo Power!

  16. #16
    New Member
    Join Date
    Mar 2003
    Location
    USA
    Posts
    10
    yes

  17. #17
    Addicted Member Vitani's Avatar
    Join Date
    Jul 2001
    Location
    England
    Posts
    134
    hmm, does your DLL rely on any other DLLs outside of the .NET framework?
    If you can dream it, you can do it - Moo Power!

  18. #18
    New Member
    Join Date
    Mar 2003
    Location
    USA
    Posts
    10
    yes

    Sort of strange things. The C# DLL uses a legacy C DLL. Therefore, inside the C# DLL I have a lot DllImport lines. This woeks fine as long as I am writing a ,NET application that uses the C# DLL,

    Now after deleting the C# DLL and recreating it again for sanity check, I can no longer add it to my VB 6.0 project (using the add reference dialog). I now get "Can't add reference to the specified file".

    This is getting strange

  19. #19
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    are you using your C# dll in a vb6 app? you have to compile it in a special way to it work properly..sometime ago i did that if you search the forum you will find some posts about it
    \m/\m/

  20. #20
    New Member
    Join Date
    Mar 2003
    Location
    USA
    Posts
    10
    Any chance you can remeber the link. I've been searching all day. No luck.

    Thanks

  21. #21
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You have to make the C# dll into a COM dll. I don't know where PT Exorcist's post is but there is a walkthrough in the help files titled 'Walkthrough: Creating COM Objects with Visual Basic .NET'. If there isn't one similar for C# then just translate that one.

  22. #22
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    \m/\m/

  23. #23
    New Member
    Join Date
    Mar 2003
    Location
    USA
    Posts
    10
    Many thanks.

    I was able to communicate with the .NET DLL fine. I am experimenting with argument passing now. Thanks a lot.

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