![]() |
|
Using a class in a C# DLL in delphi... ( Is that even possible?) |
Ariesnl
Member #2,902
November 2002
![]() |
I have a DLL made for C# or C++ If that DLL just worked with functions, there would not be a problem.. BUT... All functions I need are in a certain class wich I need to instantiate first... I doubt Delphi can handle a constructor in the C++ way ... anyone with a smart idea Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard) |
Niunio
Member #1,975
March 2002
![]() |
If you know the "internal name" of the method may be you can use (pseudo): PROCEDURE CsharpProcedure (Object: POINTER); CDECL; EXTERNAL 'shared_lib_name' NAME 'CsharpMangledName'; PROCEDURE PascalClass.Method; BEGIN CsharpProcedure (SELF.CsharpObject); END;
----------------- |
BAF
Member #2,981
December 2002
![]() |
You can't pull a "C# dll" in because they aren't normal DLLs, it's all intermediate .NET code, IIRC. Same with managed c++ DLLs. |
Ariesnl
Member #2,902
November 2002
![]() |
The thing also uses namespaces.. there is no such thing in Delphi as far as I know.. I'd rather use C# or C++ .. but by boss is affraid I will be the only one who understands the code Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard) |
Tobias Dammers
Member #2,604
August 2002
![]() |
If the project you're working on is a Delphi one, sticking with Delphi is the sane thing to do. --- |
Kibiz0r
Member #6,203
September 2005
![]() |
There's a .NET flavor of nearly every language. I bet you could use the Delphi implementation and it would work fine. But then you need the .NET Framework to run it, unless there's a way you can compile the Delphi.NET project natively and statically...? --- |
BAF
Member #2,981
December 2002
![]() |
If it was compiled natively, it wouldn't be .NET at that point. There is also no way around having the framework if you're interacting with other .NET assemblies. |
Peter Hull
Member #1,136
March 2001
|
What you ask is possible but IMO you would add complication for little gain. If the rest of your company is using Delphi then stick to that. Having said which, RAD Studio 2007 includes Delphi .NET (link), or there is a project called 'Delphi.NET' on Sourceforge (link) You can call .NET assemblies from non-managed code (link. Your .NET classes get wrapped by COM objects. I think Delphi can work with COM objects, can't it? Pete
|
Niunio
Member #1,975
March 2002
![]() |
Peter Hull said: I think Delphi can work with COM objects, can't it? I used COM objects in Delphi 6 some years ago. ----------------- |
Tobias Dammers
Member #2,604
August 2002
![]() |
I don't think the pain is going to be worth the gain. --- |
Audric
Member #907
January 2001
|
If the class only serves as a namespace, you can write (still in C#) static functions that wrap each method you need: instanciate the object, call method, release object. It should be much easier to call such static methods from Delphi. |
|