Re: C# Dll Question
From: glenn (ghancock_at_softeksoftware.com)
Date: 03/18/05
- Next message: Clint (cmueller_at_online.nospam): "Re: need do I compile the application again?"
- Previous message: Picander: "400 usercontrols to display take too much time - any solution?"
- In reply to: Sean Hederman: "Re: C# Dll Question"
- Next in thread: Ravindra Sadaphule: "Re: C# Dll Question"
- Reply: Ravindra Sadaphule: "Re: C# Dll Question"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Mar 2005 11:05:53 -0500
Ok, I got all this to work, but my next question is, how do I select a
class/function to export so that the delphi application can see it?
Thanks,
glenn
"Sean Hederman" <usemy@blogentry.com> wrote in message
news:d1a9sv$bjh$1@ctb-nnrp2.saix.net...
> In your C# DLL do the following:
>
> AssemblyInfo.cs
> ----------------
> [assembly: ComVisible(true)]
>
> Then, right-click on the project in the Solution Explorer, select
> Properties, choose Configuration Properties\Build, and set "Register for
COM
> Interop" to "True".
>
> Now when you build your project it will make it COM-compatible and
register
> it on your machine. You should now be able to reference the C# library in
> your Delphi code.
>
> "glenn" <ghan***@softeksoftware.com> wrote in message
> news:e3GAP1mKFHA.3652@TK2MSFTNGP10.phx.gbl...
> >I understand but you are backwards. I am trying to write a dll in C#
> > (managed code) and call that dll from Delphi 6 which is unmanaged.
Delphi
> > 2005 supports all the .NET stuff but our project is currently being
> > managed
> > in Delphi 6 which does not.
> >
> > So to recap. I want to write a dll in C# that performs a function that
> > just
> > pops up a message box and says hello world. I then want to call that
> > function from inside my delphi application so that the message box pops
> > up.
> >
> > I'm also behind the times a little with all this managed code stuff so
I'm
> > not sure what the differences are from what managed and unmanaged code
> > exactly means.
> >
> > Thanks,
> >
> > glenn
> >
> > "Ajay Kalra" <ajaykalra@yahoo.com> wrote in message
> > news:1111000544.398559.57520@g14g2000cwa.googlegroups.com...
> >> Before you jump into this, you should make certain that if Delphi is
> >> going to support .Net. If it is or is going to, it will be all mute
> >> point as you can develop in C# or whatever to produce managed code and
> >> consue it in Delphi.
> >>
> >> If Delphi is not going to support managed code, then you will need to
> >> write a COM server in managed code. The link I provided in my first
> >> reply shows how to do it(ComVisible attribute).
> >>
> >> >since c# does not support the old DLL processes which you seem
> >> > to have just confirmed,
> >>
> >> I am not what you mean here. You can call unmanaged DLLs using
> >> interop/PInvoke in managed code(C#). That means your Delphi code
> >> (whatever is exported by it) can be used in a managed code. If you have
> >> a COM server in Delphi, you can use it in C#.
> >>
> >> ------
> >> Ajay Kalra
> >> ajaykalra@yahoo.com
> >>
> >
> >
>
>
- Next message: Clint (cmueller_at_online.nospam): "Re: need do I compile the application again?"
- Previous message: Picander: "400 usercontrols to display take too much time - any solution?"
- In reply to: Sean Hederman: "Re: C# Dll Question"
- Next in thread: Ravindra Sadaphule: "Re: C# Dll Question"
- Reply: Ravindra Sadaphule: "Re: C# Dll Question"
- Messages sorted by: [ date ] [ thread ]