Hello!

I'm experiencing a bug right now with dynamic linking. I have an extern c function which compiles in a dll project (VampEngine) and links in a console app (Application). In the console app when this extern c gets called, it jumps back in the same position and calls itself again in an infinity loop! and eventually, I get a segmentation fault.

You can check the project on GitHub (it's not that long) but the important files are:



GitHub File:VampEngine/src/core.cpp (This is where I implement the extern functions)

GitHub File:VampEngine/src/Client/VampEngine.h (What the client includes)

GitHub File:VampEngine/src/Client/src/core.hpp (Client's wrapper class for the actuall core class in the dll)

GitHub File:VampEngine/src/Client/src/application.hpp (The client inherits this)

GitHub File:Application/src/main.cpp (Clients main)


By the way, I removed the extern "C" and replaced it with extern because I was getting undefined references when I was trying to build the Client Console App.

The inclusion all down to the Client is described in the following:

main.cpp includes VampEngine.h

VampEngine.h includes application.hpp and EntryPoint.h

application.hpp (The client inherits this) includes core.hpp

The problem occures when the first extern c function Vamp_Core_Constructr(const char *, uint width, uint height) is getting called inside the constructor of
core.hpp. With the help of gdb o saw that when this extern c was getting called, it was actually jumping back on the same position of the code and calling this function all over again.

If you wish to compile and run the project:
I support a Premake4 script which can help you create project settings for visual studio, code blocks or even a make file.
Just run:
Code:
premake4 gmake //for a make script
premake4 codeblocks //for codeblocks
premake4 xcode3 //for xcode3 
premake4 codelite //for codelite