Advertisement

Linking Project to PhysX and other modules

Started by September 11, 2021 01:00 AM
3 comments, last by SexySkeletonBoy 3 years, 1 month ago

Hello, I have been working on creating a C++ game engine in Visual Studio for a little over a year now and have decided to start from scratch with all that I have learned and make a new, cleaner version of my code.

One of the issues I faced was my file sizes being too large, I am hoping this time around to properly separate my modules so that I do not waste so much space. while I know how to do this in some cases, I am trying to figure out how to properly link PhysX to my program.

I am aware that I can just list the file location in ‘additional include directories’, but I am unsure if this is the best way to go about it. If I distribute my game, how will I know where others keep their PhysX download? I am hoping to find a way to locate where PhysX is stored, OR to find the standard location in which I should assume PhysX is located.

Regarding file sizes: Don't go overboard trying to make the files too small. File sizes tend to follow something of a scale-free or fat-tail law, but with truncation at too small sizes. A few files really do need to be 12,000 lines. Most files are likely less than 1,000 lines. Files that are only 30 lines or less have a really hard time pulling their own weight – there's overhead in thinking about (and finding) individual files, so at some point, small things get put in the same file.

Regarding dynamic linking on Windows, there are two libraries: the “Link Library” (with the .lib extension,) and the “dynamic library” (with the .dll extension.)

When you build the program, you link against the .lib file, but when the user runs the program, the system will go looking for the .dll file. The system will look in the same directory as the .exe file, and in the PATH. For DLLs you build yourself, you can just dump them all in the same directory as the .EXE file. For third party dependencies, there are typically installers that you ship with your games installer, that installs the libraries in some shared location, and makes sure they are discoverable in the path for the system program loader.

enum Bool { True, False, FileNotFound };
Advertisement

@undefined Thanks so much for your quick and detailed reply. This is exactly the info I needed.

Now I am just curious about if I need to do anything to change the PATH? I am pretty sure it's specific to the system and not the program, so adjusting it would only change my computer?

And what about the .h Files stored in the SDKs? Should they just be copied into my project files? Or will I still have to find a way to reference the location of their PhysX install?

@undefined Further reading has taught me that I copy the .h files into my project directory in most cases.

Thanks so much for the assistance!

This topic is closed to new replies.

Advertisement