Author | Topic: DLL-dependency problem | |
---|---|---|
Frans Vermeulen | DLL-dependency problem on Thu, 05 Sep 2019 11:44:13 +0200 I have a project that creates 2 dll's Project Dll-1 Dll-2 Dll-1 contains function1 Dll-2 contains function2 When I call function1 in function2, the Project compiles without any problem, however Dll-2 becomes dependent on Dll-1 - this is not what I want-. When building only Dll-2 I get an unresolved external error -this is what I would like to happen when I rebuild the Project-. I have fallen into this trap more than once now. Is there a way to avoid/detect it? Regards, Frans Vermeulen | |
Peter Alderliesten | Re: DLL-dependency problem on Fri, 06 Sep 2019 10:55:14 +0200 Frans, > I have a project that creates 2 dll's > > Project > Dll-1 > Dll-2 > > Dll-1 contains function1 > Dll-2 contains function2 > > When I call function1 in function2, the Project compiles without any problem, > however Dll-2 becomes dependent on Dll-1 - this is not what I want-. > When building only Dll-2 I get an unresolved external error > -this is what I would like to happen when I rebuild the Project-. > I have fallen into this trap more than once now. Is there a way to avoid/detect it? I can only assume that there's a dependency created in DLL2. I don't know what the unresolved error is and where it points to (the main EXE or DLL1). Peter | |
Frans Vermeulen | Re: DLL-dependency problem on Fri, 06 Sep 2019 14:17:53 +0200 Hi Peter, The unresolved external is a compiler error that is thrown at compile time. There is no main exe involved. The project-manager is creating a dependency, and I do not know if this is intentional, and why. Problem: Dll-1 belongs to a server application, being present at a datacenter, Dll-2 belongs to the corresponding client application at client-sites. They are on different computers on different networks. Either server-application or the client application fails to start. The cause of the problem is difficult to find, only by using "dlldepend" you will be able to see the dependency. Regards, Frans Vermeulen > Frans, > > > I have a project that creates 2 dll's > > > > Project > > Dll-1 > > Dll-2 > > > > Dll-1 contains function1 > > Dll-2 contains function2 > > > > When I call function1 in function2, the Project compiles without any problem, > > however Dll-2 becomes dependent on Dll-1 - this is not what I want-. > > When building only Dll-2 I get an unresolved external error > > -this is what I would like to happen when I rebuild the Project-. > > I have fallen into this trap more than once now. Is there a way to avoid/detect it? > > I can only assume that there's a dependency created in DLL2. > I don't know what the unresolved error is and where it points to (the main > EXE or DLL1). > > Peter Frans Vermeulen <fv@gbor.nl> | |
Andreas Gehrs-Pahl | Re: DLL-dependency problem on Fri, 06 Sep 2019 20:54:05 -0400 Frans, >Project > Dll-1 > Dll-2 >Dll-1 contains function1 >Dll-2 contains function2 >The project-manager is creating a dependency, >and I do not know if this is intentional, and why. That's exactly what it is supposed to do. If you don't want function2 to call function1 in DLL-1, but instead get an unresolved external error when linking, just create two separate projects. The whole purpose of a project is to imply and automatically create those dependencies between the different targets of the project. If those are stand-alone DLLs, one belonging to a Server somewhere and one belonging to a workstation somewhere else, create a Server.xpj and a separate Client.xpj project file. They can both reference the same source code files that might be shared, but only the dependent DLLs should be created in those project files. Alternatively, if you don't want any external dependencies, create the DLLs in separate Projects and manually use *.lib references in your Server and Client projects. Then you just need to (manually) make sure that the DLLs are built before the executables are, using a batch file, for example. Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [F]: https://www.facebook.com/AbsoluteSoftwareLLC | |
frans | Re: DLL-dependency problem on Sat, 07 Sep 2019 14:19:23 +0200 Hi Andreas, Thanks for the anwer. This was exacly what I meant with my question. Unfortunately 5 minutes after my initial post, I fell again into the trap. In order to get client- and servercode in sync, I have to have both visible at the same time, I have to reconsider my workflow. Regards, Frans Vermeulen > Frans, > > >Project > > Dll-1 > > Dll-2 > > >Dll-1 contains function1 > >Dll-2 contains function2 > > >The project-manager is creating a dependency, > >and I do not know if this is intentional, and why. > > That's exactly what it is supposed to do. > > If you don't want function2 to call function1 in DLL-1, but instead get an > unresolved external error when linking, just create two separate projects. > > The whole purpose of a project is to imply and automatically create those > dependencies between the different targets of the project. > > If those are stand-alone DLLs, one belonging to a Server somewhere and one > belonging to a workstation somewhere else, create a Server.xpj and a > separate Client.xpj project file. They can both reference the same source > code files that might be shared, but only the dependent DLLs should be > created in those project files. > > Alternatively, if you don't want any external dependencies, create the DLLs > in separate Projects and manually use *.lib references in your Server and > Client projects. Then you just need to (manually) make sure that the DLLs > are built before the executables are, using a batch file, for example. > > Hope that helps, > > Andreas > -- > Andreas Gehrs-Pahl > Absolute Software, LLC > > phone: (989) 723-9927 > email: Andreas@AbsoluteSoftwareLLC.com > web: http://www.AbsoluteSoftwareLLC.com > [F]: https://www.facebook.com/AbsoluteSoftwareLLC -- | |
Jim Lee | Re: DLL-dependency problem on Tue, 10 Sep 2019 01:22:58 +0200 > Dll-1 contains function1 > Dll-2 contains function2 so what about new DLL-0 which contain Function used by DLL-1 and/or DLL-2 [PROJECT.XPJ] DLL-0.DLL DLL-1.DLL DLL-2.DLL MyApp.EXE [DLL-0.DLL] COMPILE_FLAGS = /dll:dynamic /n /q /w /o\OBJ\ $START-AUTODEPEND APIFUNC.OBJ $STOP-AUTODEPEND APIFUNC.PRG [DLL-1.DLL] COMPILE_FLAGS = /dll:dynamic /n /q /w /o\OBJ\ $START-AUTODEPEND XXX.obj $STOP-AUTODEPEND XXX.PRG DLL-0.LIB [DLL-2.DLL] COMPILE_FLAGS = /dll:dynamic /n /q /w /o\OBJ\ $START-AUTODEPEND YYY.obj $STOP-AUTODEPEND YYY.PRG DLL-0.LIB [MyApp.EXE] COMPILE_FLAGS = -q -w /o\OBJ\ $START-AUTODEPEND MYMAIN.OBJ $STOP-AUTODEPEND MYMAIN.PRG when use Function of DLL DLL-0.LIB --- Diese E-Mail wurde von AVG auf Viren geprüft. http://www.avg.com | |
Frans Vermeulen | Re: DLL-dependency problem on Wed, 11 Sep 2019 16:12:07 +0200 Hi Jim, Thanks for the reply, Adding this 3rd dll corresponds with the idea of client and server processing the same data. I will try and see if this decreases the chances of making mistakes. Regards, Frans Vermeulen > > Dll-1 contains function1 > > Dll-2 contains function2 > > so what about new DLL-0 which contain Function used by DLL-1 and/or DLL-2 > > [PROJECT.XPJ] > DLL-0.DLL > DLL-1.DLL > DLL-2.DLL > MyApp.EXE > > [DLL-0.DLL] > COMPILE_FLAGS = /dll:dynamic /n /q /w /o\OBJ\ > $START-AUTODEPEND > APIFUNC.OBJ > $STOP-AUTODEPEND > APIFUNC.PRG > > [DLL-1.DLL] > COMPILE_FLAGS = /dll:dynamic /n /q /w /o\OBJ\ > $START-AUTODEPEND > XXX.obj > $STOP-AUTODEPEND > XXX.PRG > DLL-0.LIB > > [DLL-2.DLL] > COMPILE_FLAGS = /dll:dynamic /n /q /w /o\OBJ\ > $START-AUTODEPEND > YYY.obj > $STOP-AUTODEPEND > YYY.PRG > DLL-0.LIB > > [MyApp.EXE] > COMPILE_FLAGS = -q -w /o\OBJ\ > $START-AUTODEPEND > MYMAIN.OBJ > $STOP-AUTODEPEND > MYMAIN.PRG > when use Function of DLL > DLL-0.LIB > > > > --- > Diese E-Mail wurde von AVG auf Viren geprüft. > http://www.avg.com > Frans Vermeulen <fv@gbor.nl> | |
Jack Duijf | Re: DLL-dependency problem on Sat, 14 Sep 2019 16:52:01 +0200 On Thu, 05 Sep 2019 11:44:13 +0200, Frans Vermeulen wrote: >I have a project that creates 2 dll's > >Project > Dll-1 > Dll-2 > >Dll-1 contains function1 >Dll-2 contains function2 > >When I call function1 in function2, the Project compiles without any problem, >however Dll-2 becomes dependent on Dll-1 - this is not what I want-. >When building only Dll-2 I get an unresolved external error >-this is what I would like to happen when I rebuild the Project-. >I have fallen into this trap more than once now. Is there a way to avoid/detect it? > >Regards, >Frans Vermeulen If you are certain, all DLL"s are loaded at runtime, you can also do as follows... follows: Result = &("Function2()") Regards Jack Duijf ------------------------------------------------------------- Also a member off the XXP (http://www.xxp.nl) |