VO library must become a DLL?

This forum is meant for questions and discussions about the X# language and tools
Post Reply
kitz
Posts: 87
Joined: Wed Nov 29, 2017 8:56 am

VO library must become a DLL?

Post by kitz »

Hi!
I ported a VO library with nearly no errors to a VS2019 project using VOXporter.
After porting an VO application I referenced the ported library. So there is now a .exe and a .dll
Is it possible to have the used methods/functions from a library of one project included in the .exe of another project in VS2019?
If yes, how?

BR Kurt
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

VO library must become a DLL?

Post by Chris »

Hi Kurt,

Do you mean you want to include everything in just one exe, instead of having a separate dll and exe? In this case, you can simply add the prg files themselves of your library to your main project. Just select Add Existing and select all the library .prg files.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

VO library must become a DLL?

Post by wriedmann »

Hi Kurt,
.NET does not knows the concept of a linked in library.
On the other side, DLLs are loaded only at the first need (contrarily to VO where all DLLs referenced with _DLL statements are loaded at the program start).
Of course you can reference DLLs in another project: for this purpose I have defined a post build action that copies these DLLs to a common lib directory, and in the other project these are added via add reference to a file (not from the GAC). In the German Visual Studio 2017 this is on the tab page "Durchsuchen".
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

VO library must become a DLL?

Post by Jamal »

Hi Kurt,

You may want to create a project as Class Library. See project properties, General tab, Output Type property.

When you add the class library, X# will create a prg file with the BEGIN NAMESPACE code block and a class block within. Add yours functions or methods just like in VO.

This will create a DLL which you may reference in other projects.

Jamal
kitz
Posts: 87
Joined: Wed Nov 29, 2017 8:56 am

VO library must become a DLL?

Post by kitz »

Thanks guys.
I learned it doesn't work the VO way, so I will need the DLL.
Copying the prg's is not an option, because these will be used in several projects and should be maintained in one place. I never used DLLs before (just the VO system DLLs) and was afraid of problems.
I looks like as VOXporter did all for me, I just made a reference to the other project and all was compiled successfully and the .exe just worked :)
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

VO library must become a DLL?

Post by wriedmann »

Hi Kurt,
as I wrote: .NET is much, much better than VO because it loads referenced DLLs only when needed. And if you look at an executable normally it will be small, even if it references several DLLs.
Do the same in VO: only including the GUI classes in an application makes it very large.
The behavior of .NET saves us all the work we have done to load DLLs dynamically to keep the load times short and the exe sizes small.
But there is a downside: even if you should not do it: VO can handle circular references (exe references lib1 and lib2, lib1 references lib2, and lib2 references lib1), but .NET cannot do it.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

VO library must become a DLL?

Post by Chris »

Just a further note, you do not need to necessarily copy files when adding them to a project, you can tell the IDE to use them from their original location. In VS, when you add files, you need to click on the small down arrow next to the "Add button", then select "Add as Link" from the context menu.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
kitz
Posts: 87
Joined: Wed Nov 29, 2017 8:56 am

VO library must become a DLL?

Post by kitz »

Thx Chris!
I'm slowly adapting to VS...
Post Reply