Can you use a C# library in a AMP-server? - c#

Is it possible for me to build some database functionality in a C#-library (using LINQ 2 SQL) and then somehow import it into a php (joomla) project?

One way to do it is to register the .NET assembly as COM object (using regasm.exe) and then consume it from PHP.

Related

IronPython in PyCharm 3rd Party DLLs

I have IronPython right now working with PyCharm. Is it possible to import classes from a 3rd party .NET DLL that I have written and get code completion with it?
Currently I'm creating a .NET application where users can upload their Python scripts and interact with the application. Basically I want to create a .NET library that users can import into their Python project and use classes from it with code completion.
Is this possible?
It looks like PyCharm handles Python C extensions by generating a "skeleton" module and using that for completion. The same approach would work for IronPython easily, thanks to .NET reflection, but I don't know if PyCharm supports that sort of extensibility.

How to connect to Mysql from C# as MT4 dll?

I am new to C#. I want to connect to Mysql Database from MT4 using DLL. I found how to create MT4 dll using C# here : http://vb6-to-csharp.blogspot.com/2012/04/code-to-export-c-dll-to-metatrader.html , and how to connect to Mysql database using C# here: http://www.codeproject.com/Tips/423233/How-to-Connect-to-MySQL-Using-Csharp .
How to combine both to connect to Mysql from MT4 ?
Thanks
MT4 is C++ not C#. In fact by using C# you are complicating things unnecessarily because you need to marshall the datatypes between the two languages. Also you didn't specify what part of mt4 you want to connect. I assume it's the client terminal via an expert advisor's dll. The simplest way is to write a dll using C++ which will export the methods you need for writing to the database.
If you prefer C# over MQL a viable option is to use a framework that lets you code a complete EA using C#. For example this bridge: NQuotes : C# API for MetaTrader let's you doing that. Then you can use your MySQL tutorial as it is.

.Net/c# Wrapper class for Delphi Application

I have source code for Delphi application. I need to access the methods in the Delphi source from a C# application. My actual requirement is to create C# wrapper class on Delphi methods, So that I can call it from dot net application. Can you please help me to write C# wrapper on Delphi code?
Hydra from RemObjects might be a solution to your problem (i haven't tried it):
http://www.remobjects.com/hydra/
Hydra makes it possible to use native Delphi methods in a .NET application and use .NET methods in af Delphi application.
I have did that by creating Web service from Delphi and call it from c#.
another solution to write Delphi Com DLL and use it in C#.

How to use C# code in C++ project

I have some code in C# which I want to use in other project (coded in C++).
From what I researched, I need to create a .lib but MSVS only creates .dll (I think..). I think is possible to use the .dll by using LoadLibrary() over C++ but seems not very friendly.
1 - Can I create the .lib in MSVS? If not, how can I create it.
2 - What is the best way to integrate the code? By the .lib or using .dll + LoadLibrary()?
The easiest option, honestly, is to use C++/CLI. That lets you use both object systems (.NET, and traditional C++ with its standard template library).
Is it managed C++ ? If so you can directly add a reference to the C# dll and use it.
What you need is a com compliant class in c#:
http://en.allexperts.com/q/C-3307/2008/2/Using-C-class-C.htm
http://blogs.msdn.com/b/deeptanshuv/archive/2005/06/26/432870.aspx
One possibility is to make your C# code Managed COM compliant. Then use the standard COM api's (QueryInterface etc) to call the C# COM code.
The codeproject sample may be useful
http://www.codeproject.com/KB/cs/ManagedCOM.aspx

What do I need to do to implement an "out of proc" COM server in C#?

I am trying to implement an "out of proc" COM server written in C#. How do I do this?
I need the C# code to be "out of proc" from my main C++ application, because I cannot load the .NET runtime into my main process space
WHY?:
My C++ code is in a DLL that is loaded into many different customer EXE's, some of which use different versions of the .NET runtime. Since there can only be one runtime loaded into a single process, my best bet seems to be to put my C# code into another process.
You can create COM+ components using System.EnterpriseServices.ServicedComponent. Consequently, you'll be able to create out-of-proc and in-proc (client) component activation as well as all COM+ benefits of pooling, remoting, run as a windows service etc.
Here we can read that it is possible, but the exe will be loaded as an library and not started in it's own process like an exe. I don't know if that is a problem for you? It also contains some possible solutions if you do want to make it act like a real out of process com server. But maybe using another way of inter process communication is better. Like .Net Remoting.
I cannot recommend this as the way, but you could create a COM-callable wrapper for your C# library, then create a VB6 ActiveX exe project that delegates calls to your C# library.
Why can't you load the .net runtime into you process space? It is possible to host the .net runtime and call into .net using COM.

Categories

Resources