I'm writing a web app hosting several tasks in FPC, however one of the task is calling a function residing in a .NET dll. I've made a flat C interface for the dll (so that I can call it from FPC easily), and it works just fine IF the dll is somehow loaded first. Currently, I use a trick to debug my web app from Visual Studio and makes the app calls the dll function. This automatically bootstraps the CLR and as long as there's no update on the dll my app would stay working. However, this is of course cumbersome. I wonder if there's any way to load the dll without such a dirty trick.
Mailing lists / fpc-pascal / 2014-01
Load .NET dll (or bootstrap CLR to be precise) from FPC
10 messages · 6 people · –
- Lleledumbo 5
- DDmitry Boyarintsev 1
- Hhinst 1
- MMark Morgan Lloyd 1
- MMichael Van Canneyt 1
- SSven Barth 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
leledumbo wrote 8 lines
Nasty. Presumably the .dll wants to invoke entry points in the calling program: I don't know whether you can work around that and you might end up having to do something like http://www.mono-project.com/Embedding_Mono
I'm writing a web app hosting several tasks in FPC, however one of the task is calling a…
I'm writing a web app hosting several tasks in FPC, however one of the task is calling a…
leledumbo wrote 5 lines
For the same task, I typically create .NET executable that would use the .NET dll and call the executable from FPC code. No hacks - no worries.
thanks,
Dmitry
I'm writing a web app hosting several tasks in FPC, however one of the task is calling a…
"leledumbo" wroteI'm writing a web app hosting several tasks in FPC, however one of the
task
is calling a function residing in a .NET dll. I've made a flat C interface for the dll (so that I can call it from FPC easily), and it works just
fine
IF the dll is somehow loaded first. Currently, I use a trick to debug my
web
app from Visual Studio and makes the app calls the dll function. This automatically bootstraps the CLR and as long as there's no update on the
dll
my app would stay working. However, this is of course cumbersome. I wonder if there's any way to load the dll without such a dirty trick.
There are basically two possibilities: adjust the .Net assembly to be hosted as a COM server, generate a TLB and use that to generate a interface unit for FPC. Please ask Google or the search engine of your choice for the first two steps.
The other possibility is to host the .Net runtime in your application. For this you can take a look at these links:
http://www.codeproject.com/Articles/416471/CLR-Hosting-Customizing-the-CLR http://code.msdn.microsoft.com/windowsdesktop/CppHostCLR-e6581ee0 The CLRCreateInstance function seems to be defined in mscoree.dll, so you'll need to import that.
I've not done this myself yet, but I hope it helps you.
Regards,
Sven
Sven Barth wrote 22 lines
The CrossTalk project for Delphi automates this latter task for you. It also imports .NET assemblies. Maybe we can ask if it would work with FPC.
Michael.
For the same task, I typically create .NET executable that would use the .NET dll and…
For the same task, I typically create .NET executable that would use the
.NET dll and call the executable from FPC code. No hacks - no worries
This could be possible, maybe just with a little delay. This is the only task that uses .NET dll, the others are pure FPC. I'll consider it, good idea.
Seems like CLR caches each running .NET executable including dll, so when a .NET dll is loaded by .NET exe, other non-.NET application shouldn't worry about loading it.
task fine web dll There are basically two possibilities: adjust the .Net assembly to be…
COM server... I thought I've read that somewhere, I'll search again.
The code to host .NET runtime seems plenty, but quite possible. I'll try to make a good use of those links.
The CrossTalk project for Delphi automates this latter task for you. It also imports .NET…
This seems to be the best solution, though a proprietary one. I don't think my office would like to buy, especially since the price is somewhat shocking :p
