Using .NET DLL?

Windows specific questions.
Post Reply
oyster
Posts: 274
Joined: Oct 11, 2005 10:46

Using .NET DLL?

Post by oyster »

there are some related questions:
1. is there any detailed tutorial to use .net DLL in freebasic?
2. can System.Windows.Forms be used to created GUI?
3. can we bundle .net DLL into EXE file compiled by freebasic? When the EXE runs, no DLL is extacted into the harddisk.
4. can we bundle all .net DLLs into EXE file compiled by freebasic? I mean the application only use functions in A.dll, but A.dll has a dependency of B.dll.

Thanks.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Using .NET DLL?

Post by D.J.Peters »

If you need the NET runtime environment why do you not use VB.net (VisualBasic for NET) ?

Joshy
LonnieTC
Posts: 9
Joined: Aug 18, 2022 23:14

Re: Using .NET DLL?

Post by LonnieTC »

Hi All,

I am actually interested in this as well since I am playing with some FreeBASIC code that will be able to call various 3rd-party DLL libraries (i.e. generated from C/C++, Golang, and .NET, etc.)

Any support or suggestions on this would be greatly apprciated.
mcombatti
Posts: 5
Joined: Dec 15, 2022 23:54
Location: Spartanburg, SC - USA
Contact:

Re: Using .NET DLL?

Post by mcombatti »

oyster wrote: Aug 16, 2022 9:30 there are some related questions:
1. is there any detailed tutorial to use .net DLL in freebasic?
2. can System.Windows.Forms be used to created GUI?
3. can we bundle .net DLL into EXE file compiled by freebasic? When the EXE runs, no DLL is extacted into the harddisk.
4. can we bundle all .net DLLs into EXE file compiled by freebasic? I mean the application only use functions in A.dll, but A.dll has a dependency of B.dll.

Thanks.
This topic came up in another forum for Xojo. Eugene Dakin had a solution available to make raw C# C compatible libraries (DLLs). Libraries created using this method can be consumed by any language capable of accessing native C libraries.

https://scispec.ca/index.php/blog/55-cr ... l-for-xojo

To answer your questions directly:
1) See above for link to detailed tutorial
2) If you can embed it in your DLL, you can use it in your Freebasic application.
3) No - you are provided static DLLs when you compile C#. C# runtime assembly is not compatible with Freebasic. You cannot bind the libraries to your Freebasic EXE. Binding C# to C# exes, it is possibly to eliminate side-file DLL's & bind the libraries directly to your EXE.
4) You will need to build each DLL that you wish your application to use by hand, and then invoke the declares from within Freebasic.
Gregorygall
Posts: 2
Joined: Apr 05, 2023 10:36

Re: Using .NET DLL?

Post by Gregorygall »

oyster wrote: Aug 16, 2022 9:30 there are some related questions:
1. is there any detailed tutorial to use .net DLL in freebasic?
2. can System.Windows.Forms be used to created GUI?
3. can we bundle .net DLL into EXE file compiled by freebasic? When the EXE runs, no DLL is extacted into the harddisk.
4. can we bundle all .net DLLs into EXE file compiled by freebasic? I mean the application only use functions in A.dll, but A.dll has a dependency of B.dll.

Thanks.
Hello,

It is possible to use .NET DLLs in FreeBASIC, but there may not be a detailed tutorial specifically for this. However, you can find resources online that explain how to use external libraries in FreeBASIC, which may help with using .NET DLLs. It's important to note that using .NET DLLs requires the .NET runtime to be installed on the target machine.

Yes, System.Windows.Forms can be used to create GUI in FreeBASIC. It provides a way to create and manage windows, dialogs, buttons, text boxes, and other controls.

Yes, it is possible to bundle .NET DLLs into the EXE file compiled by FreeBASIC using a technique called "embedding resources." This involves adding the DLLs as resources to the EXE file, and then using the appropriate functions to load them at runtime. This way, the DLLs are not extracted to the hard disk.

It is possible to bundle all .NET DLLs into the EXE file compiled by FreeBASIC using the same technique as in 3. However, this may result in a larger EXE file size and longer load times. It's also important to note that bundling all DLLs may not be necessary, as only the DLLs that the application actually uses need to be included.
marcov
Posts: 3455
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Using .NET DLL?

Post by marcov »

Gregorygall wrote: Apr 06, 2023 8:37 However, you can find resources online that explain how to use external libraries in FreeBASIC, which may help with using .NET DLLs.
.NET DLLs are .NET assemblies containing IL. To my best knowledge there is no runnable native code in them. So you need to instruct a .NET interpreter instantiated in your process or another process to load and process them.

The classic answer is go via COM or the other way around (let a .NET program call FB dlls via interop). IIRC Remobjects had some product for Delphi to make this possible (Hydra, https://www.remobjects.com/hydra/), which I assume is some COM and header generators, but I dont know the details how it works.
Yes, System.Windows.Forms can be used to create GUI in FreeBASIC. It provides a way to create and manage windows, dialogs, buttons, text boxes, and other controls.
How, examples or even just an explanation ? Connecting them over IPC/TCP/IP IMHO doesn't count. The answer is a bit vague and ChatGPTy.
adeyblue
Posts: 299
Joined: Nov 07, 2019 20:08

Re: Using .NET DLL?

Post by adeyblue »

marcov wrote: Apr 06, 2023 9:33 How, examples or even just an explanation ?
It's a spam bot, the only reply youre going to get will be about Indian driving test answers or something
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Using .NET DLL?

Post by caseih »

Welcome to the brave new world of ChatGPT-powered forum spambots. Most likely we will see this post (and the bot's other post) edited in the near future to add urls.
Post Reply