467,888 Members | 1,372 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,888 developers. It's quick & easy.

Delphi coded DLL, read by .NET Web Service?

Dear List,

We have a large application written in Delphi. I am writing a mobile app
written in .NET (C#) which reads and writes into the Delphi applications
Oracle database via a .NET Web Service. Much of the data centred
functionality on the application is quite involved, and to re-write all this
functionality in the .NET web service would be very time consuming. Our idea
is to perhaps develop a DLL written in Delphi, which copies across all
required code from the main application. The .NET web service would then load
and run this DLL as and when required, merely passing parameters in and out
etc...

Does anyone know if it is possible for a .NET Web Service to use a Delphi
written DLL?

Thanks for any tips,

D
Oct 29 '07 #1
  • viewed: 3398
Share:
4 Replies
=?Utf-8?B?ZGF2ZWJ5dGhlc2Vh?= <da**********@discussions.microsoft.com>
wrote in news:A8**********************************@microsof t.com:
Our idea is to perhaps develop a DLL written in
Delphi, which copies across all required code from the main
application. The .NET web service would then load and run this DLL as
and when required, merely passing parameters in and out etc...
Surely there must be an easier way?

Perhaps you can use RemObjects SDK?

http://www.remobjects.com/product/?id={5B241E66-7BAE-4D46-B2BA-
03EB9DC5229D}

Remobjects can expose your Delphi application as a remoting service or web
service. This would make communicating with .NET much easier.
Does anyone know if it is possible for a .NET Web Service to use a
Delphi written DLL?
I believe it is possible using DLLImports... but you'll get into a lot of
Interop and unmanaged code. Not something you want to consider lightly.

Or perhaps you can wrap the DLL as a COM object and it'll be much easier to
call in .NET.
Oct 30 '07 #2
Hi,

Thanks for the reply. I think its going to be a more tricky task than I
first thought, mmh, it might require a re-think. I'll definetly look into the
COM option. The RemObjects library looks good, its whether or not we want to
spend more cash on something. anyway, time will tell..

Cheers,
David

Our idea is to perhaps develop a DLL written in
Delphi, which copies across all required code from the main
application. The .NET web service would then load and run this DLL as
and when required, merely passing parameters in and out etc...

Surely there must be an easier way?

Perhaps you can use RemObjects SDK?

http://www.remobjects.com/product/?id={5B241E66-7BAE-4D46-B2BA-
03EB9DC5229D}

Remobjects can expose your Delphi application as a remoting service or web
service. This would make communicating with .NET much easier.
Does anyone know if it is possible for a .NET Web Service to use a
Delphi written DLL?

I believe it is possible using DLLImports... but you'll get into a lot of
Interop and unmanaged code. Not something you want to consider lightly.

Or perhaps you can wrap the DLL as a COM object and it'll be much easier to
call in .NET.
Oct 30 '07 #3
The .NET web service would then load and run this DLL as and when
required, merely passing parameters in and out etc...
Sure. There are several viable ways to get the functionality you want.

Delphi can create standard Win32 dlls. You can package your code in those
which C# can call fine. Check out http://www.pinvoke.net/. They have tons
of examples of calling win32 dlls from .Net. I haven't built a dll in
Delphi in years, but if I recall correctly, it was pretty easy. There
should be tons of examples online.

Delphi can also create COM objects. Once that is created it's pretty easy
to add it as a reference in c# and have visual studio create a wrapper
class for accessing the object. I built quite a few COM objects in Delphi a
few years back. It was a pretty painless process as Delphi 6 & 7 had
wizards to do the heavy lifting for you.

I probably shouldn't say this on a Microsoft newsgroup. If the majority of
your application is built in Delphi you should really consider building the
..Net piece in Delphi for .Net instead of C#. All .Net languages compile
down to the CIL so from a .Net standpoint it doesn't matter what language
you use. It should be noted that you'll still need to use one of the
methods I described above for the interop issue. I merely recommend it as
an option so that you can have consistency across your application. It will
make it easier to move team members around and ongoing maintenance.

--
Andrew Faust
andrew[at]andrewfaust.com
http://www.andrewfaust.com
"davebythesea" <da**********@discussions.microsoft.comwrote in message
news:A8**********************************@microsof t.com...
Dear List,

We have a large application written in Delphi. I am writing a mobile app
written in .NET (C#) which reads and writes into the Delphi applications
Oracle database via a .NET Web Service. Much of the data centred
functionality on the application is quite involved, and to re-write all
this
functionality in the .NET web service would be very time consuming. Our
idea
is to perhaps develop a DLL written in Delphi, which copies across all
required code from the main application. The .NET web service would then
load
and run this DLL as and when required, merely passing parameters in and
out
etc...

Does anyone know if it is possible for a .NET Web Service to use a Delphi
written DLL?

Thanks for any tips,

D
Oct 31 '07 #4
Hi Andrew,

Thanks for the information - that was all very useful!

I didnt realise you could code .NET Web Services in Delphi, that may provide
the solution for us. Interesting about the DLL's. I also suspected that
surely a Win32 DLL was independent of what programming language was used to
create it. I reckon I will try this out with a simple example and see how it
goes.

Thanks again,
David

The .NET web service would then load and run this DLL as and when
required, merely passing parameters in and out etc...

Sure. There are several viable ways to get the functionality you want.

Delphi can create standard Win32 dlls. You can package your code in those
which C# can call fine. Check out http://www.pinvoke.net/. They have tons
of examples of calling win32 dlls from .Net. I haven't built a dll in
Delphi in years, but if I recall correctly, it was pretty easy. There
should be tons of examples online.

Delphi can also create COM objects. Once that is created it's pretty easy
to add it as a reference in c# and have visual studio create a wrapper
class for accessing the object. I built quite a few COM objects in Delphi a
few years back. It was a pretty painless process as Delphi 6 & 7 had
wizards to do the heavy lifting for you.

I probably shouldn't say this on a Microsoft newsgroup. If the majority of
your application is built in Delphi you should really consider building the
.Net piece in Delphi for .Net instead of C#. All .Net languages compile
down to the CIL so from a .Net standpoint it doesn't matter what language
you use. It should be noted that you'll still need to use one of the
methods I described above for the interop issue. I merely recommend it as
an option so that you can have consistency across your application. It will
make it easier to move team members around and ongoing maintenance.

--
Andrew Faust
andrew[at]andrewfaust.com
http://www.andrewfaust.com
"davebythesea" <da**********@discussions.microsoft.comwrote in message
news:A8**********************************@microsof t.com...
Dear List,

We have a large application written in Delphi. I am writing a mobile app
written in .NET (C#) which reads and writes into the Delphi applications
Oracle database via a .NET Web Service. Much of the data centred
functionality on the application is quite involved, and to re-write all
this
functionality in the .NET web service would be very time consuming. Our
idea
is to perhaps develop a DLL written in Delphi, which copies across all
required code from the main application. The .NET web service would then
load
and run this DLL as and when required, merely passing parameters in and
out
etc...

Does anyone know if it is possible for a .NET Web Service to use a Delphi
written DLL?

Thanks for any tips,

D
Nov 1 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by lukeharpin | last post: by
2 posts views Thread by xpanta | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.