Discussion:
Sharing Windows dl with VB.NET and vice-versa
(too old to reply)
Al vas
2008-08-04 05:11:07 UTC
Permalink
Hi,

We had this great idea to share database information between two products
using dll's. We have since found out that the windows dll that is created
from Delphi 5 and the dll that is created from VB.NET are not interoperable
ie they dont recognise each other and cannot be used. Am i right in
assuming this and if so any ideas on the best way to share information. I
understand COM objects might be the way but unfortunately I don't know much
about this.

Any help appreciated

TIA

Alex
Peter Below (TeamB)
2008-08-04 09:03:53 UTC
Permalink
Post by Al vas
Hi,
We had this great idea to share database information between two
products using dll's. We have since found out that the windows dll
that is created from Delphi 5 and the dll that is created from VB.NET
are not interoperable ie they dont recognise each other and cannot be
used. Am i right in assuming this and if so any ideas on the best
way to share information. I understand COM objects might be the way
but unfortunately I don't know much about this.
If you create a normal Win32 DLL with Delphi that exports functions
using only API-compatible data types and with the stdcall calling
convention *and* using "name" clauses on the export statements so the
exported names are solidly defined and not subject to name mangling
then a .NET based program can use this DLL through the PInvoke
mechanism build into .NET for Windows API access. The functions
exported by the DLL have to be declared appropriately in the .NET
application, of course. PInvoke calls are considered unsafe code, this
may create problems if the program runs in a contect with limited trust
(e.g. from a network drive).

If you create an assembly in a .NET language that has to be usable from
a Win32 language the classes and methods exported by the assembly have
to be marked as COM compatible via appropriate attributes. You can then
use one of the tools that come with the .NET SDK to create a COM
library as wrapper for the assembly and that wrapper can then be used
by any COM-aware application like any other COM library (e.g.: import
the type library for it into Delphi and you have a usable interface to
it).

This also works the other way around: if you create a COM library in
Delphi you can use a tool in the .NET SDK to create a wrapper assembly
for it for use in .NET applications. We have two groups on for these
topics here:

borland.public.delphi.com.interop.dotnet
borland.public.delphi.com.interop.win32
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
Ivan
2008-08-04 19:15:11 UTC
Permalink
Other options include Hydra from remobjects www.remobjects.com and managed extensions for vcl from
http://managed-vcl.com/

Loading...