Import C DLL functions into VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yvanovic
    New Member
    • Feb 2008
    • 2

    Import C DLL functions into VB

    Hello

    I have a question and hope you might help me, I am writing a DLL for software package and I was also exporting the dll' function to a Visual Basic Application, my question is: in VB when you are import the DLL functions there is a way of doing it which is :

    Code:

    Private Declare Function Calculate Lib "C:\Project.dll " (ByVal c As Double, ByVal d As Long) As Double

    And if you have a second function to import you have to do the same, but what about if you have like 50 functions to export, do you still write 50 lines and each time specifying the DLL path? Or there is another way where you just define the path only once,

    Thanks in advance for any help
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    1.Compile the dll
    2.Copy the DLL to system32 folder.
    3.Regeister with windows using REGSVR32 key.
    4.Access the DLL from Vb from Project-------> References
    5.Use that in VB.

    Comment

    • yvanovic
      New Member
      • Feb 2008
      • 2

      #3
      Thanks Debasisdas

      i did copy the dll in the System32 folder and when i want to register with REGSVR32 key

      eg: c:\>regsvr32 myProject.dll

      this error msg occurs

      " The module ""myProject.dll "" was loaded but the entry-point DllUnregisterSe rver was not found.
      Make sure that ""myProject.dll "" is a valid DLL or OCX file and then try again

      Thanks for you help

      Comment

      Working...