# Change default core library path

**URL:** https://discourse.gstreamer.org/t/change-default-core-library-path/4544
**Category:** Application Development
**Tags:** windows
**Created:** [April 30, 2025, 10:40am UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544 "2025-04-30T10:40:50Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![JeffZZ](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/j/858c86/32.png) [@JeffZZ](https://discourse.gstreamer.org/u/JeffZZ)
#### Post date: [April 30, 2025, 10:40am UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/1 "2025-04-30T10:40:50Z")

</div>

Hi,

I’m working on Windows, using C++ and Visual Studio. I’ve added an implementation of gstreamer into an already existing project and now I need to pack it and test it into our target machines.

The problem is that due to space and other project constraints, I cannot install gstreamer in each individual target machine, so my idea to package the program is to put all the necessary DLLs inside a folder within the build folder and read the necessary DLLs from there. Thus the ideal folder structure I would like to have is the following:

\root (where the .exe resides)  
-----\gstreamer  
------------\core (all the core libraries)  
-------------\plugins (all the plugin libraries)  
(I hope that the previous structure is understandable)

I’ve managed to make the program read the plugins from this structure using the following code before calling gst\_init():

`_putenv_s("GST_PLUGIN_PATH", plugin_path.c_str());`

But I can’t seem to find a way to do the same for the core libraries, does anyone have any on how I coul achieve this ?

Thank you

---

<div class="post-metadata">

### Author: ![tpm](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@tpm](https://discourse.gstreamer.org/u/tpm)
#### Post date: [April 30, 2025, 12:12pm UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/2 "2025-04-30T12:12:56Z")

</div>

Isn’t that covered by the system `PATH` variable?

---

<div class="post-metadata">

### Author: ![JeffZZ](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/j/858c86/32.png) [@JeffZZ](https://discourse.gstreamer.org/u/JeffZZ)
#### Post date: [April 30, 2025, 1:18pm UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/3 "2025-04-30T13:18:31Z")

</div>

What do you mean by that ?

---

<div class="post-metadata">

### Author: ![tpm](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@tpm](https://discourse.gstreamer.org/u/tpm)
#### Post date: [April 30, 2025, 1:38pm UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/4 "2025-04-30T13:38:54Z")

</div>

I mean that the `PATH` environment variable governs the search location for dynamic libraries (DLLs) on Windows.

---

<div class="post-metadata">

### Author: ![JeffZZ](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/j/858c86/32.png) [@JeffZZ](https://discourse.gstreamer.org/u/JeffZZ)
#### Post date: [April 30, 2025, 1:56pm UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/5 "2025-04-30T13:56:30Z")

</div>

Ok, if you mean changing the `PATH` environment variable from the OS perspective, in other words manually going to the OS configuration (in this case windows), and changing or adding the `PATH` to the specific folder I need it.

I can’t see this approach usable for my particular case, as I would need to do it for every target machine where this software is installed (and it’s quite a long list of servers).

If you mean doing it programatically, changing this `PATH` each time the program is executed, while not ideal I would consider this as a short term solution.

---

<div class="post-metadata">

### Author: ![tpm](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@tpm](https://discourse.gstreamer.org/u/tpm)
#### Post date: [April 30, 2025, 2:09pm UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/6 "2025-04-30T14:09:28Z")

</div>

All I’m saying is that this is not really a GStreamer specific thing 🙂

---

<div class="post-metadata">

### Author: ![JeffZZ](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/j/858c86/32.png) [@JeffZZ](https://discourse.gstreamer.org/u/JeffZZ)
#### Post date: [April 30, 2025, 2:14pm UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/7 "2025-04-30T14:14:26Z")

</div>

Well, I thought it was, as gstreamer has the `GST_PLUGIN_PATH` for these same eaxct purpose but for plugin libraries, so I assumed there would be something similar for core libraries within gstreamer. Thus, I’ve decided to ask here.

---

<div class="post-metadata">

### Author: ![bradh](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/bradh/32/877_2.png) [@bradh](https://discourse.gstreamer.org/u/bradh)
#### Post date: [May 1, 2025, 12:20am UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/8 "2025-05-01T00:20:33Z")

</div>

Those core libraries are effectively “gstreamer”. They need to be loaded before any environmental variable(s) that they specify could have effect.

---

<div class="post-metadata">

### Author: ![bka](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/bka/32/1226_2.png) [@bka](https://discourse.gstreamer.org/u/bka)
#### Post date: [May 2, 2025, 5:38am UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/9 "2025-05-02T05:38:55Z")

</div>

We use NSIS for creating windows apllication setup and with that we can add gstreamer to the system path. In the uninstaller we remove it from the path. We kept the same folder structure as gstreamer installation so in the nsis script this works:  
EnVar::SetHKLM  
EnVar::AddValue “Path” “path-to-our-app\gstreamer\bin”

---

<div class="post-metadata">

### Author: ![ylatuya](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/ylatuya/32/91_2.png) [@ylatuya](https://discourse.gstreamer.org/u/ylatuya)
#### Post date: [May 5, 2025, 12:28pm UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/10 "2025-05-05T12:28:40Z")

</div>

The easiest solution is to distribute the GStreamer libraries in the same directory as your application and programatically update the variables needed to locate the plugins and the plugin scanner before initializing GStreamer (GST\_PLUGIN\_PATH and GST\_PLUGIN\_SCANNER).

If you want to keep the GStreamer libraries in a subdirectory, I would not recommend the approach of adding that subdirectory to PATH in the installer as recommended by @bka since you might break other applications deployed on that machine. There are 2 possible solutions for that:

- Enable [delay-load](https://learn.microsoft.com/en-us/cpp/build/reference/linker-support-for-delay-loaded-dlls?view=msvc-170) and call `Add­Dll­Directory` with the GStreamer libraries subdir before calling `gst_init`.
- Create a “fake” assembly manifest for the GStreamer libraries in your subfolder and make your application use it with `#pragma comment(linker, "/manifestDependency:\"name='GStreamer' processorArchitecture='*' version='1.0.0.0' type='win32' \"")`

---

<div class="post-metadata">

### Author: ![wbtcpip](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/wbtcpip/32/138_2.png) [@wbtcpip](https://discourse.gstreamer.org/u/wbtcpip)
#### Post date: [July 3, 2025, 8:46pm UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/11 "2025-07-03T20:46:59Z")

</div>

i use [SetDllDirectory](https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setdlldirectorya) and i put gstreamer dlls wherever i want. it wortks fine.

---

<div class="post-metadata">

### Author: ![JeffZZ](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/j/858c86/32.png) [@JeffZZ](https://discourse.gstreamer.org/u/JeffZZ)
#### Post date: [September 30, 2025, 2:20pm UTC](https://discourse.gstreamer.org/t/change-default-core-library-path/4544/12 "2025-09-30T14:20:57Z")

</div>

Yeah, that was more or less what i ended up doing, I had to do some handpicking of the DLLs needed to even start the exe, but after that I was able to kinda put the path I wanted.
