If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[RESOLVED] Add header files & lib files at runtime?

Hi,

I was created a dynamic library (Used win32 App) & compiled with no error.

Then i was created my main application (MFC) & paste the .h,.lib,.dll files from the source path(dll App Path) to destination path(Main App Path).
If i used the below command in my app means the project working good.

Code:

#include "Alg.h"
#Progma Command(lib, "VTAlg.lib")

& also paste the VTAlg.dll in my app path.

here Alg.h contains the some methods , In future i will edit the function like below for my client requirement but no function name & Arguments change. The changes made in inside function(Logically changed) only.

My client contains only .exe file + .dll file.

My requirement,

So after change the method i will send only .dll file to my client

If i change my lib file name VTAlg2.lib instead of VTAlg1.lib (But Same Function name & Arg type)means how can i edit the code below

Re: Add header files & lib files at runtime?

A header and .lib files have nothing to do with running the final executable. They only are used when building your application.

Similarly, a DLL has nothing to do when building your application -- a DLL only is used when you're running your application.

So I have no idea what you're asking. You build your application, then you install the EXE's and DLL's at the client site, and you run the app at the client's site. Your source code or lib files have absolutely no part in running the final application.

Re: Add header files & lib files at runtime?

To run your application if you really, really want to have the version number as part of the .dll name and you want to use the latest dll version and you are using LoadLibrary then a 'kludge' is to try to use LoadLibrary with a name which has a very high version number. Assuming this fails, then try LoadLibrary with a lower version etc etc until LoadLibrary succeeds. You then have loaded the latest version of the .dll. Something like

Re: Add header files & lib files at runtime?

Originally Posted by saraswathisrinath

If I change the dll name means its very convenient for my clients to replace the old one.

How is that convenient? I now have to change my source code or whatever code I'm writing that uses the DLL to read a new name. That is not convenient, as it now puts my own code at risk because of the changes that I would need to make.

You shouldn't be changing the name of the DLL. What you should be doing is ensuring that the current version of the DLL that is "good" is the one being loaded. And you do that by telling your clients "I have a later version of the DLL. Make sure you are loading version xxx.xxx of the DLL". Programmers who know how to use DLL's are perfectly capable of loading the correct version at runtime if you tell them that a later version is available.

Re: Add header files & lib files at runtime?

I did some logic using algorithm for some calculation using **InData 2D Array.

In future, I found one more best algorithm means, just i will replace the logic using the 2D( **InData) array.

For this I will get the best result in my application.

If I change the dll name means its very convenient for my clients to replace the old one.

Also, gives a hint to find the logic to me.

I don't see how that's more convenient and it seems like a design flaw to me. I'd rethink your approach rather than chasing something that doesn't make sense. Other app builders don't do it that way, and there's a reason for it.

Re: Add header files & lib files at runtime?

First I'm used add.h, Alg1.lib & Alg1.dll files & prepared MyApp.exe, after changed made in logic, I'm having add.h, Alg2.lib & Alg2.dll. Now how can I run my application?

I cannot see anything here to doubt about. If you change .lib file, you have no option other than full rebuild of your .exe and .dll. The new .exe will know the new name of .dll by linking to the proper .lib. No matter what the name of header or lib was.

Re: Add header files & lib files at runtime?

Just Browse the dll from particular location & save the path in to a string then only i will load the DLL at run time.

I'm sure, Myself only didn't clear you correctly.

But I just copied the 1st version of dll & lib files in to my main project header files location & then Build the mainapp.exe

When loading DLL explicitly at runtime, you never need LIB file at compile time. So all your talks about LIB were definitely misguiding. If you want to get some real help, you have to learn explaining your problem clear, concise and unambiguously.

As for the archives you uploaded, I never experiment with binaries which origins I'm uncertain of.