Converting a C++ project to a dll

Hi,

I have 2 massive (several header and class files) C++ projects.
Lets call them project A and B.

The way it works is that project A gets data from the user, does some processing and writes to a bunch of text files.

Project B takes these bunch of text files as input, reads them, does a lot of computation on that data. Finally, it writes to a set of text files.

Finally Project A reads those text files, does some computations again on the processed data and returns the result back to the user.

Because of so many I/O operations, the overall process suffers from poor performance.

I was just wondering if there is a way to convert Project B into a dll? So that we can reference that dll from Project A and call Project B's methods. That way, we can avoid reading and writing of files.

Please let us know steps to convert the existing C++ project
remove "main" (possibly, wrap it as a new function if you need what it does), and then if I remember it from visual studio, you put a keyword on the functions you want to have in the dll (dllexport: I think) and change the project settings (look online for exact process). Mash compile and it will render a dll, a .lib, and youll want the .h file for the exposed functions.

put the .lib and exposed functions in the other project, and connect the code to call it.

Another option, one of many, is to make a ramdisk. This makes a chunk of your computer's ram look like a disk drive, and can be very powerful for scenarios like yours. Modern computers can easily give up a few GB for this.



Thank you very much.
That surely sounds doable :)

Didn't quite understand what you meant by "...put the .lib and exposed functions in the other project, and connect the code to call it. "

Shouldn't referring Project B's dll in Project A all that is required? How does one put exposed functions in other project?


you include a header file with the functions that you exported in the target project, and add the .lib file to the project as well. When compiled, it will depend on the .dll file to be in the path.

Honestly I would just get this process down with a couple of dummy projects, make a little library that kicks out hello world, figure out what buttons to press in the settings, then try it on the bigger project. Its not that hard, but I think this would help you get a smooth transition and work out the details (which I glossed over, largely because I haven't done it in some time).



Last edited on
Topic archived. No new replies allowed.