xsharp.eu • VO library must become a DLL?
Page 1 of 1

VO library must become a DLL?

Posted: Mon Nov 11, 2019 1:38 pm
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

VO library must become a DLL?

Posted: Mon Nov 11, 2019 2:24 pm
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.

VO library must become a DLL?

Posted: Mon Nov 11, 2019 2:27 pm
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

VO library must become a DLL?

Posted: Mon Nov 11, 2019 4:14 pm
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

VO library must become a DLL?

Posted: Tue Nov 12, 2019 10:34 am
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 :)

VO library must become a DLL?

Posted: Tue Nov 12, 2019 11:06 am
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

VO library must become a DLL?

Posted: Tue Nov 12, 2019 2:13 pm
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.

VO library must become a DLL?

Posted: Mon Nov 18, 2019 7:38 am
by kitz
Thx Chris!
I'm slowly adapting to VS...