Announcement

Collapse
No announcement yet.

Use VB.NEt Dll in PowerBasic

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

  • Use VB.NEt Dll in PowerBasic

    Hi,
    I have created a VB.NET Library and want to use it in a PowerBasic program.

    Here is my code:

    DeclareSub Send_PortBit Lib"MCCSSVB.dll" (ByVal BitNum AsInteger, ByVal Bit AsInteger)

    The following error message popup:
    The application failed to initialize properly (0x000007b).

    Someone told me PowerBasic can't use .NET Dll directly. Is it true?

    Thanks a lot,

  • #2
    I did some tests with a very simple C# 2005 DLL that I wrote, which should be very similair to VB 2005 DDLs.

    I believe all DLLs produced by VB .NET 2005 and C# must be accessed using the COM-interface, that PB do support. I am not sure if all DLLs can be used, I had some issues I could not resolve, but I did not invest as much time in it as I wanted. I will probably someday!

    See my older thread , but there are probably plenty of others.

    I hope PowerBASIC, Inc. will update their manuals for the next PB version, so they add compatbility issues with the .NET languages too, just like they do with Visual Basic 6.
    Last edited by Vincent van der Leun; 11 Jan 2008, 10:20 AM.

    Comment


    • #3
      http://www.powerbasic.com/support/pb...ad.php?t=35880
      hellobasic

      Comment


      • #4
        Thank you so much.
        But why I got the following error when I run the following command:
        regasm MCCSSVB.dll

        "Windows can't find the "regasm". Make sure you typed the name correctly....

        Comment


        • #5
          Code:
          Declare Sub Send_PortBit Lib"MCCSSVB.dll" (ByVal BitNum As Integer, ByVal Bit As Integer)
          Perhaps lack of alias fix would fix the problem?
          Code:
          Declare Sub Send_PortBit Lib"MCCSSVB.dll" ALIAS "Send_PortBit"(ByVal BitNum As Integer, ByVal Bit As Integer)
          Or better yet, LoadLibrary/FreeLibrary
          Engineer's Motto: If it aint broke take it apart and fix it

          "If at 1st you don't succeed... call it version 1.0"

          "Half of Programming is coding"....."The other 90% is DEBUGGING"

          "Document my code????" .... "WHYYY??? do you think they call it CODE? "

          Comment


          • #6
            Hi Cliff,

            VB, like C# and many other Microsoft languages (I believe even VB6) produce ActiveX DLLs. They can not produce "real" win32 DLLs, like PB produce.

            I believe the only Microsoft product dan can generate normal DLLs is Visual C++.

            Best regards,
            Vincent

            Comment


            • #7
              VB, like C# and many other Microsoft languages (I believe even VB6) produce ActiveX DLLs. They can not produce "real" win32 DLLs, like PB produce.
              :doh: I forgot about that. (Although I thought .NET would have wized up and not be ActiveX based, but I should have known better)

              I was going to run a test and make a VB6 Dll to use in PB, but dummy me forgot how to export a function in VB. (I thought I just had to make it public, but maybe thats the problem is that it is not a "REAL" dll, but rather a COM object?)

              Luckily I do not have to worry about it much cause I usually only use REAL DLL's, but it is a nice thing to brush up on from time to time
              Engineer's Motto: If it aint broke take it apart and fix it

              "If at 1st you don't succeed... call it version 1.0"

              "Half of Programming is coding"....."The other 90% is DEBUGGING"

              "Document my code????" .... "WHYYY??? do you think they call it CODE? "

              Comment


              • #8
                Jane,

                RegAsm should be supplied with your Visual Studio .NET development software. Have you searched your computer for it?

                If you don't have it, you could try to download one of Microsoft's free Visual Studio Express languages, I'd guess RegASM.exe is supplied with those versions too. I don't know if newer versions work with files produced by older Visual Studio .NET versions.

                ------

                More background information on RegAsm:
                Source: MSDN

                The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. Once a class is registered, any COM client can use it as though the class were a COM class. The class is registered only once, when the assembly is installed. Instances of classes within the assembly cannot be created from COM until they are actually registered.

                ------

                Best regards,
                Vincent

                Comment


                • #9
                  Originally posted by Vincent van der Leun View Post
                  VB, like C# and many other Microsoft languages (I believe even VB6) produce ActiveX DLLs. They can not produce "real" win32 DLLs, like PB produce.
                  I thought the same but I was able to create a standard DLL using VB6 following the indications found here: http://www.windowsdevcenter.com/pub/...ll.html?page=1
                  thinBasic programming language
                  Win10 64bit - 8GB Ram - i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

                  Comment


                  • #10
                    Does this help?

                    Here is a link to a post that I remembered.

                    http://www.powerbasic.com/support/pb...00+new+classes
                    Mark Strickland, CISSP, CEH
                    SimplyBASICsecurity.com

                    Comment

                    Working...
                    X