export dll function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • An Ony

    #1

    export dll function

    Hello,

    I'm trying to write a program (dll) to use with mIRC.
    mIRC wants me to use these kind of functions:

    int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL
    show, BOOL nopause)

    translated into C# code, I think it's this:

    int function(int mWnd,int aWnd, char [] data, char [] parms, bool show,bool
    nopause)

    now another problem is exporting this function so mIRC can see it. A
    tutorial says something about creating a DEF file, but that's probably only
    for C++? A search on MSDN gave me this: "This requires a DLL export, which
    ..NET Framework does not support" Does this mean I can't do this and all my
    work was for nothing?

    tia,


  • Tu-Thach

    #2
    export dll function

    You will not be able to export dll function in C#. Maybe
    mIRC will take COM objects?

    Tu-Thach
    [color=blue]
    >-----Original Message-----
    >Hello,
    >
    >I'm trying to write a program (dll) to use with mIRC.
    >mIRC wants me to use these kind of functions:
    >
    >int __stdcall procname(HWND mWnd, HWND aWnd, char *data,[/color]
    char *parms, BOOL[color=blue]
    >show, BOOL nopause)
    >
    >translated into C# code, I think it's this:
    >
    >int function(int mWnd,int aWnd, char [] data, char [][/color]
    parms, bool show,bool[color=blue]
    >nopause)
    >
    >now another problem is exporting this function so mIRC[/color]
    can see it. A[color=blue]
    >tutorial says something about creating a DEF file, but[/color]
    that's probably only[color=blue]
    >for C++? A search on MSDN gave me this: "This requires a[/color]
    DLL export, which[color=blue]
    >..NET Framework does not support" Does this mean I can't[/color]
    do this and all my[color=blue]
    >work was for nothing?
    >
    >tia,
    >
    >
    >.
    >[/color]

    Comment

    • An Ony

      #3
      Re: export dll function

      yes mIRC can take COM objects...


      "Tu-Thach" <tuthach@yahoo. com> schreef in bericht
      news:8ca501c35b 55$9aa8b000$a00 1280a@phx.gbl.. .[color=blue]
      > You will not be able to export dll function in C#. Maybe
      > mIRC will take COM objects?
      >
      > Tu-Thach
      >[color=green]
      > >-----Original Message-----
      > >Hello,
      > >
      > >I'm trying to write a program (dll) to use with mIRC.
      > >mIRC wants me to use these kind of functions:
      > >
      > >int __stdcall procname(HWND mWnd, HWND aWnd, char *data,[/color]
      > char *parms, BOOL[color=green]
      > >show, BOOL nopause)
      > >
      > >translated into C# code, I think it's this:
      > >
      > >int function(int mWnd,int aWnd, char [] data, char [][/color]
      > parms, bool show,bool[color=green]
      > >nopause)
      > >
      > >now another problem is exporting this function so mIRC[/color]
      > can see it. A[color=green]
      > >tutorial says something about creating a DEF file, but[/color]
      > that's probably only[color=green]
      > >for C++? A search on MSDN gave me this: "This requires a[/color]
      > DLL export, which[color=green]
      > >..NET Framework does not support" Does this mean I can't[/color]
      > do this and all my[color=green]
      > >work was for nothing?
      > >
      > >tia,
      > >
      > >
      > >.
      > >[/color][/color]


      Comment

      • Bill Priess

        #4
        Re: export dll function

        C# DLLs cannot be exported due to the underlying nature of .NET. What you
        might be able to do is translate your work over to C++ and do it that way,
        but as for C#, it's out.


        HTH,

        Bill P.
        On Tue, 5 Aug 2003 14:17:20 +0200, An Ony <nowhere@somewh ere.net> wrote:
        [color=blue]
        > Hello,
        >
        > I'm trying to write a program (dll) to use with mIRC.
        > mIRC wants me to use these kind of functions:
        >
        > int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms,
        > BOOL
        > show, BOOL nopause)
        >
        > translated into C# code, I think it's this:
        >
        > int function(int mWnd,int aWnd, char [] data, char [] parms, bool
        > show,bool
        > nopause)
        >
        > now another problem is exporting this function so mIRC can see it. A
        > tutorial says something about creating a DEF file, but that's probably
        > only
        > for C++? A search on MSDN gave me this: "This requires a DLL export,
        > which
        > .NET Framework does not support" Does this mean I can't do this and all
        > my
        > work was for nothing?
        >
        > tia,
        >
        >
        >[/color]



        --
        Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

        Comment

        • Tu-Thach

          #5
          Re: export dll function

          Then you can write your COM object in C# and .NET and use
          it with mIRC. You still need the .NET run-time
          environment in order for it to work.

          Tu-Thach
          [color=blue]
          >-----Original Message-----
          >yes mIRC can take COM objects...
          >
          >
          >"Tu-Thach" <tuthach@yahoo. com> schreef in bericht
          >news:8ca501c35 b55$9aa8b000$a0 01280a@phx.gbl. ..[color=green]
          >> You will not be able to export dll function in C#.[/color][/color]
          Maybe[color=blue][color=green]
          >> mIRC will take COM objects?
          >>
          >> Tu-Thach
          >>[color=darkred]
          >> >-----Original Message-----
          >> >Hello,
          >> >
          >> >I'm trying to write a program (dll) to use with mIRC.
          >> >mIRC wants me to use these kind of functions:
          >> >
          >> >int __stdcall procname(HWND mWnd, HWND aWnd, char[/color][/color][/color]
          *data,[color=blue][color=green]
          >> char *parms, BOOL[color=darkred]
          >> >show, BOOL nopause)
          >> >
          >> >translated into C# code, I think it's this:
          >> >
          >> >int function(int mWnd,int aWnd, char [] data, char [][/color]
          >> parms, bool show,bool[color=darkred]
          >> >nopause)
          >> >
          >> >now another problem is exporting this function so mIRC[/color]
          >> can see it. A[color=darkred]
          >> >tutorial says something about creating a DEF file, but[/color]
          >> that's probably only[color=darkred]
          >> >for C++? A search on MSDN gave me this: "This requires[/color][/color][/color]
          a[color=blue][color=green]
          >> DLL export, which[color=darkred]
          >> >..NET Framework does not support" Does this mean I[/color][/color][/color]
          can't[color=blue][color=green]
          >> do this and all my[color=darkred]
          >> >work was for nothing?
          >> >
          >> >tia,
          >> >
          >> >
          >> >.
          >> >[/color][/color]
          >
          >
          >.
          >[/color]

          Comment

          • An Ony

            #6
            Re: export dll function

            Hmm, I come from Java and don't know C++, but will "C++ .NET" be able to
            export DLL functions?

            "Bill Priess" <no.spam@nospam .com> schreef in bericht
            news:oprtfu580v cimqky@localhos t...[color=blue]
            > C# DLLs cannot be exported due to the underlying nature of .NET. What you
            > might be able to do is translate your work over to C++ and do it that way,
            > but as for C#, it's out.
            >
            >
            > HTH,
            >
            > Bill P.
            > On Tue, 5 Aug 2003 14:17:20 +0200, An Ony <nowhere@somewh ere.net> wrote:
            >[color=green]
            > > Hello,
            > >
            > > I'm trying to write a program (dll) to use with mIRC.
            > > mIRC wants me to use these kind of functions:
            > >
            > > int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms,
            > > BOOL
            > > show, BOOL nopause)
            > >
            > > translated into C# code, I think it's this:
            > >
            > > int function(int mWnd,int aWnd, char [] data, char [] parms, bool
            > > show,bool
            > > nopause)
            > >
            > > now another problem is exporting this function so mIRC can see it. A
            > > tutorial says something about creating a DEF file, but that's probably
            > > only
            > > for C++? A search on MSDN gave me this: "This requires a DLL export,
            > > which
            > > .NET Framework does not support" Does this mean I can't do this and all
            > > my
            > > work was for nothing?
            > >
            > > tia,
            > >
            > >
            > >[/color]
            >
            >
            >
            > --
            > Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/[/color]


            Comment

            • Arild Fines

              #7
              Re: export dll function

              Jonathan Schafer wrote:[color=blue]
              > You can use Visual Studio to create Win32 dll's that are not part of
              > .NET. Just make a C++ project (non-managed) and make it a dll. Then
              > it's just like programming C++ before .NET.[/color]

              It doesn't have to be a non-managed DLL. Managed C++ DLLs can export
              functions. What the OP should do is make a small Managed C++ DLLs which
              exports the desired functions. These functions then just delegate their
              functionality to C# classes from his original project.

              (Or go the COM route)

              --
              Arild Fines


              A Visual Studio .NET Addin for the Subversion version control system.


              Comment

              • Jonathan Schafer

                #8
                Re: export dll function

                No of course it doesn't, but it doesn't require .NET doing it the old
                fashioned way. It really depends on what the environment is.

                Jonathan Schafer

                On Wed, 6 Aug 2003 00:33:58 +0200, "Arild Fines"
                <arild.fines@sh ould.not.be.her e.broadpark.no> wrote:
                [color=blue]
                >Jonathan Schafer wrote:[color=green]
                >> You can use Visual Studio to create Win32 dll's that are not part of
                >> .NET. Just make a C++ project (non-managed) and make it a dll. Then
                >> it's just like programming C++ before .NET.[/color]
                >
                >It doesn't have to be a non-managed DLL. Managed C++ DLLs can export
                >functions. What the OP should do is make a small Managed C++ DLLs which
                >exports the desired functions. These functions then just delegate their
                >functionalit y to C# classes from his original project.
                >
                >(Or go the COM route)[/color]

                Comment

                • An Ony

                  #9
                  Re: export dll function

                  OK, I'm trying it the COM way, first time I tried to write a COM object.
                  I'm having this as code:
                  =============== =============== =============== ===>
                  ....
                  namespace QuotesDLL
                  {
                  [Guid("53D4E200-38B0-4925-9708-A96484BAF822")]
                  public interface QuoteInterface
                  {
                  [DispId(1)]
                  bool addQuote(string quote);
                  [DispId(2)]
                  string getQuote(string [] args);
                  [DispId(3)]
                  string getQuote();
                  }

                  [Guid("F4A45909-85FE-496c-AC5D-39380B92DE23")]
                  public class QuoteSystem : QuoteInterface
                  { ...
                  <============== =============== =============== =====
                  that's all good, right? Those methods in the interface are made public in
                  the implementation. Does it hurt to make other methods private? addQuote()
                  uses saveQuotes() and that's declared private, that's not interfering with
                  the whole "COM object"-idea, is it?

                  now I try to compile it, in debug mode all goes well, but I get:
                  RegAsm warning: No types were registered
                  Assembly exported to '...\QuotesDLL\ bin\Debug\Quote sDLL.tlb', and the type
                  library was registered successfully

                  trying to compile it in Release mode, I get a build error:
                  COM Interop registration failed. There are no registrable types in the built
                  assembly.

                  manual run on the debug dll:
                  RegAsm warning: No registry script will be produced since there are no types
                  to register

                  I've checked the registry and I can find the interfaceid, but not the class
                  that implements the interface.
                  I have no experience whatsoever with writing COM objects, so I don't know
                  what to do or what goes wrong.


                  And on final level, how do I call the COM object using mIRC? The command
                  works as follows:
                  /comopen name progid
                  name: some name for the connection
                  but what is progid in this case? QuotesDLL? QuoteSystem? QuoteInteface? The
                  upper hex number or the lower hex number?


                  thx so much!


                  "Tu-Thach" <tuthach@yahoo. com> schreef in bericht
                  news:0cdb01c35b 6d$452ee550$a50 1280a@phx.gbl.. .[color=blue]
                  > Then you can write your COM object in C# and .NET and use
                  > it with mIRC. You still need the .NET run-time
                  > environment in order for it to work.
                  >
                  > Tu-Thach
                  >[color=green]
                  > >-----Original Message-----
                  > >yes mIRC can take COM objects...
                  > >
                  > >
                  > >"Tu-Thach" <tuthach@yahoo. com> schreef in bericht
                  > >news:8ca501c35 b55$9aa8b000$a0 01280a@phx.gbl. ..[color=darkred]
                  > >> You will not be able to export dll function in C#.[/color][/color]
                  > Maybe[color=green][color=darkred]
                  > >> mIRC will take COM objects?
                  > >>
                  > >> Tu-Thach
                  > >>
                  > >> >-----Original Message-----
                  > >> >Hello,
                  > >> >
                  > >> >I'm trying to write a program (dll) to use with mIRC.
                  > >> >mIRC wants me to use these kind of functions:
                  > >> >
                  > >> >int __stdcall procname(HWND mWnd, HWND aWnd, char[/color][/color]
                  > *data,[color=green][color=darkred]
                  > >> char *parms, BOOL
                  > >> >show, BOOL nopause)
                  > >> >
                  > >> >translated into C# code, I think it's this:
                  > >> >
                  > >> >int function(int mWnd,int aWnd, char [] data, char []
                  > >> parms, bool show,bool
                  > >> >nopause)
                  > >> >
                  > >> >now another problem is exporting this function so mIRC
                  > >> can see it. A
                  > >> >tutorial says something about creating a DEF file, but
                  > >> that's probably only
                  > >> >for C++? A search on MSDN gave me this: "This requires[/color][/color]
                  > a[color=green][color=darkred]
                  > >> DLL export, which
                  > >> >..NET Framework does not support" Does this mean I[/color][/color]
                  > can't[color=green][color=darkred]
                  > >> do this and all my
                  > >> >work was for nothing?
                  > >> >
                  > >> >tia,
                  > >> >
                  > >> >
                  > >> >.
                  > >> >[/color]
                  > >
                  > >
                  > >.
                  > >[/color][/color]


                  Comment

                  Working...