Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Created dll for use in other language

Created dll for use in other language

Scheduled Pinned Locked Moved C#
helpcsharp
15 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Nooie

    -- modified at 18:14 Monday 16th October, 2006 (fixed so changed as still have error) Okay so I managed to make it build succesfully. But it still won't register. I still get the dllregisterserver entry point error. This is the code, simple I know! using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace CheckDate { [Guid("1AD0462D-4FA2-4072-B63B-8B1D88212389")] public class CheckDate { private int _day; private int _month; private int _year; public int day { set { _day = value; } } public int month { set { _month = value; } } public int year { set { _year = value; } } public bool checkDate() { DateTime newDateTime; string dateString; dateString = _day.ToString() + _month.ToString() + _year.ToString(); if (DateTime.TryParse(dateString,out newDateTime)) return true; else return false; } public void clear() { _day = 0; _month = 0; _year = 0; } } }

    J Offline
    J Offline
    Judah Gabriel Himango
    wrote on last edited by
    #5

    I haven't done this in awhile, so my memory is a little foggy. A couple things jump out at me: I believe you'll need an interface declared that defines the functionality you want available in COM. Something like:

    [Guid("03AD5D2D-2AFD-439f-8713-A4EC0705B4D9")]
    interface ICheckDate
    {
    void DoThis();
    void DoThat();
    }

    Then have you class implement that interface. I think you'll need the ClassInterface attribute on your class as well. Your class declaration should look like this:

    [ClassInterface(ClassInterfaceType.None), Guid("1AD0462D-4FA2-4072-B63B-8B1D88212389")]
    public class CheckDate : ICheckDate
    {
    ...
    }

    I'm a little fuzzy on this though whole .NET-to-COM interop, so take it with a grain (or generous helping ;P) of salt. p.s. next time try <pre> tags around your code snippets. *edit* Looking at that article[^] again, it seems you need to call regasm tool to register the .NET assembly. I'd definitely check out that article and see for sure what needs to be done.

    Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

    N 1 Reply Last reply
    0
    • J Judah Gabriel Himango

      I haven't done this in awhile, so my memory is a little foggy. A couple things jump out at me: I believe you'll need an interface declared that defines the functionality you want available in COM. Something like:

      [Guid("03AD5D2D-2AFD-439f-8713-A4EC0705B4D9")]
      interface ICheckDate
      {
      void DoThis();
      void DoThat();
      }

      Then have you class implement that interface. I think you'll need the ClassInterface attribute on your class as well. Your class declaration should look like this:

      [ClassInterface(ClassInterfaceType.None), Guid("1AD0462D-4FA2-4072-B63B-8B1D88212389")]
      public class CheckDate : ICheckDate
      {
      ...
      }

      I'm a little fuzzy on this though whole .NET-to-COM interop, so take it with a grain (or generous helping ;P) of salt. p.s. next time try <pre> tags around your code snippets. *edit* Looking at that article[^] again, it seems you need to call regasm tool to register the .NET assembly. I'd definitely check out that article and see for sure what needs to be done.

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

      N Offline
      N Offline
      Nooie
      wrote on last edited by
      #6

      well, I tried that too, but no success. Doh.

      using System;
      using System.Collections.Generic;
      using System.Text;
      using System.Runtime.InteropServices;
      
      namespace CheckDate
      {
          [Guid("2BE56F71-BC00-4736-8D85-9A3C6438CDA7")]
          interface ICheckDate
          {
              bool checkDate();
              void clear();
          }
      
          [ClassInterface(ClassInterfaceType.None), Guid("1AD0462D-4FA2-4072-B63B-8B1D88212389")]  
          public class CheckDate : ICheckDate
          {
              
              public int day
              {
                  set { _day = value; }
                 
              }
      
              public int month
              {
                  set { _month = value; }
             
              }
      
              public int year
              {
                  set { _year = value; }
            
              }
          
              public bool checkDate()
              {
                  DateTime newDateTime;
                  string dateString;
                  dateString = _day.ToString() + _month.ToString() + _year.ToString();
                  if (DateTime.TryParse(dateString,out newDateTime))
                      return true;
                  else
                      return false;
              }
              public void clear()
              {
                  _day = 0;
                  _month = 0;
                  _year = 0;
              }
      
          }
      }
      
      J 1 Reply Last reply
      0
      • N Nooie

        well, I tried that too, but no success. Doh.

        using System;
        using System.Collections.Generic;
        using System.Text;
        using System.Runtime.InteropServices;
        
        namespace CheckDate
        {
            [Guid("2BE56F71-BC00-4736-8D85-9A3C6438CDA7")]
            interface ICheckDate
            {
                bool checkDate();
                void clear();
            }
        
            [ClassInterface(ClassInterfaceType.None), Guid("1AD0462D-4FA2-4072-B63B-8B1D88212389")]  
            public class CheckDate : ICheckDate
            {
                
                public int day
                {
                    set { _day = value; }
                   
                }
        
                public int month
                {
                    set { _month = value; }
               
                }
        
                public int year
                {
                    set { _year = value; }
              
                }
            
                public bool checkDate()
                {
                    DateTime newDateTime;
                    string dateString;
                    dateString = _day.ToString() + _month.ToString() + _year.ToString();
                    if (DateTime.TryParse(dateString,out newDateTime))
                        return true;
                    else
                        return false;
                }
                public void clear()
                {
                    _day = 0;
                    _month = 0;
                    _year = 0;
                }
        
            }
        }
        
        J Offline
        J Offline
        Judah Gabriel Himango
        wrote on last edited by
        #7

        Did you try running regasm on the assembly instead of regsvr32?

        Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

        N 1 Reply Last reply
        0
        • J Judah Gabriel Himango

          Did you try running regasm on the assembly instead of regsvr32?

          Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

          N Offline
          N Offline
          Nooie
          wrote on last edited by
          #8

          Hi Judah, I did, but I need to ship the DLL out to another machine as well, so I am assuming they would need to use regsvr32. hence trying that.

          Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
          Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.
          
          Types registered successfully
          
          J 1 Reply Last reply
          0
          • N Nooie

            Hi Judah, I did, but I need to ship the DLL out to another machine as well, so I am assuming they would need to use regsvr32. hence trying that.

            Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
            Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.
            
            Types registered successfully
            
            J Offline
            J Offline
            Judah Gabriel Himango
            wrote on last edited by
            #9

            You'll need to register it on the target machine with regasm, I believe. .NET needs to be installed on the target machine too, so regasm will be there if .NET is installed.

            Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

            N 1 Reply Last reply
            0
            • J Judah Gabriel Himango

              You'll need to register it on the target machine with regasm, I believe. .NET needs to be installed on the target machine too, so regasm will be there if .NET is installed.

              Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

              N Offline
              N Offline
              Nooie
              wrote on last edited by
              #10

              I used the REGASM on my local machine, but I still can't see the custom control in my internal DB langauage. Once registered, they normally show. Any other way to test if its been implemented? T

              J 1 Reply Last reply
              0
              • N Nooie

                I used the REGASM on my local machine, but I still can't see the custom control in my internal DB langauage. Once registered, they normally show. Any other way to test if its been implemented? T

                J Offline
                J Offline
                Judah Gabriel Himango
                wrote on last edited by
                #11

                I have some old .NET-to-COM code along with steps to register it somewhere. I'll see if I can dig that up tomorrow. p.s. as I understand it, regasm has an optional argument you can pass it to generate a tlb file from the assmebly. If you do that, can you use the resulting tlb file in regsvr32?

                Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

                N 1 Reply Last reply
                0
                • J Judah Gabriel Himango

                  I have some old .NET-to-COM code along with steps to register it somewhere. I'll see if I can dig that up tomorrow. p.s. as I understand it, regasm has an optional argument you can pass it to generate a tlb file from the assmebly. If you do that, can you use the resulting tlb file in regsvr32?

                  Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

                  N Offline
                  N Offline
                  Nooie
                  wrote on last edited by
                  #12
                  Checkdate.tlb is not an executable file and no registration helper is registered for this file type.
                  

                  :confused: Thanks for all the help by the way I appreciate it! T

                  J 1 Reply Last reply
                  0
                  • N Nooie
                    Checkdate.tlb is not an executable file and no registration helper is registered for this file type.
                    

                    :confused: Thanks for all the help by the way I appreciate it! T

                    J Offline
                    J Offline
                    Judah Gabriel Himango
                    wrote on last edited by
                    #13

                    If you use a tool like OleView or some other COM object viewer, your regasm'd dll doesn't show up on the target system? It should! :-p

                    Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

                    N 1 Reply Last reply
                    0
                    • J Judah Gabriel Himango

                      If you use a tool like OleView or some other COM object viewer, your regasm'd dll doesn't show up on the target system? It should! :-p

                      Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

                      N Offline
                      N Offline
                      Nooie
                      wrote on last edited by
                      #14

                      Hi Judah, I just downloaded oleview to see, and it is there :-) Just can't see it in my DB langauge. damn it. Oh and when I try to expand it in Oleview it complains at me COGetClassObject failed. The system cannot find the file specified. severity: SEVERITY_ERROR, facility: FACILITY_WIN32($80070002) T

                      J 1 Reply Last reply
                      0
                      • N Nooie

                        Hi Judah, I just downloaded oleview to see, and it is there :-) Just can't see it in my DB langauge. damn it. Oh and when I try to expand it in Oleview it complains at me COGetClassObject failed. The system cannot find the file specified. severity: SEVERITY_ERROR, facility: FACILITY_WIN32($80070002) T

                        J Offline
                        J Offline
                        Judah Gabriel Himango
                        wrote on last edited by
                        #15

                        Nooie, I'm afraid I've given you all the help I know how. Maybe someone else knows where you're going wrong. Yeah, AFAIK, doing regasm on the dll built with all the specs we just went over should work. I'm afraid I don't have any other ideas.

                        Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups