folder structures

Is there any way of putting the dlls in a folder away from the compiled exe. i.e.

/…
/openFrameworksApp.exe
/libs/fmod64.dll
/libs/glut32.dll

I was hoping it might find them, but unfortunately no.

I’ve started putting fonts/images/movies into a sub ‘data’ folder, would be good to tidy up the libraries too if possible.

that’s a very good question. I wonder if it’s possible by modifying the PATH variable, perhaps with a .bat file that modifys the PATH (adding the current directory/libs) and then loads the app

these two articles explain the search order:

http://www.codeguru.com/Cpp/W-P/dll/article.php/c99
http://msdn2.microsoft.com/en-us/library/ms682586.aspx

that’s how we are doing in on linux now (because it doesn’t even search for .so’s in the same directory) - we have a bash script that modifies that environment variable (LD_LIBRARY_PATH) and loads the app.

The problem with altering the PATH variable, is that I am not sure if that is a permanent thing, or if you would run into problems later on about that.

Another option might be loading the dlls explicitly in the code with a call to LoadLibrary, or LoadLibraryEx, but I’m not sure how that could work.

we’ll experiment a bit and see if something can work on that front.

take care!
zach

ps : 0F 0.03 (release) has a “data” directory for everything, that should clean things up alot too - we are thinking on the same lines :slight_smile:

ok .bat works:

  1. put the dlls in the folder called libs
  2. create a file “clickToLaunchApp.bat” to site side by side with the exe

the content of the bat file should look like this:

  
  
path = %PATH%;libs  
openFrameworks.exe  
  

change the exe name if necessary

now if you double click the .bat file, that app will look in the right place for the DLLs and run. If you click the exe itself, it doesn’t find them (because of the paths it looks for). The change to the environment variable (path) exists only as long as that console window is open.

hope that helps -
zach

Thanks for the reply.

The bat file doesn’t work for me.

When I run the bat file, the output is :
path = [my;system;paths];libs
openframeworks.exe not recognised.

I tried an absolute path too, but that doesn’t work.

The thing is, this bath file appends the path to the end of the path variable, so each time you run it, it adds another instance of the lib path to the end, if that makes sense. When I look in the environment variables via windows, it doesn’t list them though, but when i run the batch file from the command line, when it prints the path = it has many instances of libs.

hi chris,

the .bat file only “temporarily” adds the libs file to the path, it’s not permanent.

it looks like you got the placement wrong, should be:

  
  
clickToRunApp.bat  
openframeworks.exe  
libs  
  

that or the name of the exe is wrong.

some good info here:

It is essential to remember that any changes that are made in a command window only endure until the window is closed. For permanent changes, use the method discussed in another section.

hope that helps
zach

Darn it, there was a small typo in the exe name, all works well, thanks Zach.

I wonder if the batch file is not same directory with the exe.

How we can edit the batch file ?

Hi Peter,

Is your question:

How to edit a batch file?

A batch file is simply a text file with the extension .bat. You can edit a batch file with any text editor, or, if you are an amstrads’nostalgic go on **edit **command under MS Dos.

or

What should I put inside the bat file if it’s not same directory as exe?

To give you an answer about what to put in the bat file, we might need to know your folder structure. Type or paste your English text here and click on the “Check Text” button.

Regards,
anc|hnk

OK.

For instance, my exe was located at C:\ and my launcher or bat is located at D:\.

I think i found the solution.

.bat file
path = location of your dll
change path to your exe
then execute

I not good in script.

Thanks.