Repository: godot
Issue:  Usage of included functions resulting in `.dll` not being found
Labels: bug,topic:gdextension

**Godot version:** 3.2.1

**OS/device including version:** Windows 10, build 1903

### The issue

Hey, I hope I'm in the right place with this, I've followed the example in the docs for c++: https://docs.godotengine.org/en/stable/tutorials/plugins/gdnative/gdnative-cpp-example.html. This went all right, my next step was to include opencv, so I appended additonal locations to `CPPPath`, `LIBPATH` and `LIBS` in SConstruct: https://github.com/S3B4S/opencv-gdnative/blob/gdnative/SConstruct#L165-L184

When my code _only_ includes the opencv libraries, it will compile and run fine in Godot (below example would have modified `src/gdexample.cpp` in the [example repository](https://github.com/BastiaanOlij/gdnative_cpp_example));
```cpp
// This will run fine
 
#include "gdexample.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
 
using namespace godot;
using namespace cv;
 
void GDExample::_register_methods() { ... }
 
GDExample::GDExample() { ... }
 
GDExample::~GDExample() { ... }
 
void GDExample::_init() {
    // initialize any variables here
    time_passed = 0.0;
    time_emit = 0.0;
    amplitude = 10.0;
 
    // Mat image = Mat::zeros(300, 600, CV_8UC3);
}

// other unrelated code
```

But when I do want to use a method from the imported code (so it's the exact same code snippet as above, but the `Mat image = Mat::zeros(300, 600, CV_8UC3);` line is uncommented), I run into the following error:
```cmd
ERROR: get_symbol: No valid library handle, can't get symbol from GDNative object
   At: modules/gdnative/gdnative.cpp:483
debugger-agent: Unable to listen on 7020
ERROR: terminate: No valid library handle, can't terminate GDNative object
   At: modules/gdnative/gdnative.cpp:388
ERROR: _update_placeholder: Condition "!script_data" is true.
   At: modules/gdnative/nativescript/nativescript.cpp:92
Running: D:\Program Files (x86)\Godot\Godot_v3.2.1-stable_mono_win64.exe --path C:/Users/kevin/Development/contextproject/Godot --remote-debug 127.0.0.1:6007 --allow_focus_steal_pid 9776 --position 768,420
Godot Engine v3.2.1.stable.mono.official - https://godotengine.org
OpenGL ES 3.0 Renderer: AMD Radeon RX 5700 XT

Mono: Logfile is: C:\Users\kevin\AppData\Roaming/Godot/mono/mono_logs/2020_05_10 21.36.40 (14996).txt
ERROR: Can't open dynamic library: C:/Users/kevin/Development/contextproject/Godot/bin/win64/libgdexample.dll, error: Error 126: The specified module could not be found.
.
   At: platform/windows/os_windows.cpp:2269
ERROR: get_symbol: No valid library handle, can't get symbol from GDNative object
   At: modules/gdnative/gdnative.cpp:483
ERROR: init_library: No nativescript_init in "res://bin/win64/libgdexample.dll" found
   At: modules/gdnative/nativescript/nativescript.cpp:1506
```

I'm honestly confused by the fact that it's saying it cannot find `libgdexample.dll` anymore, it's definitely there. When the lines that include `OpenCV` are commented out it does find the `.dll` file.

I'm new to this kind of stuff, so I'm not sure if I've overlooked something or that this is unexpected behaviour.
___

### Additional information in case it's needed
I've pushed the project I'm working on to [here](https://github.com/S3B4S/opencv-gdnative/tree/gdnative).

### Steps to reproduce:
Assuming that OpenCV is installed & `OPENCV_DIR` environment variable is set.
1. I've followed the instructions described in [the documentation](https://docs.godotengine.org/en/stable/tutorials/plugins/gdnative/gdnative-cpp-example.html).
2. Apply adjustments described above.
3. Run `scons platform=windows`, this should output a `libgdexample.dll` among other files in `<Godotproject>/bin/win64`
4. Open the godot project and run the main scene
5. In case OpenCV functions are used, above errors should appear.