H
H
Hocksten2015-08-15 17:29:53
Command line
Hocksten, 2015-08-15 17:29:53

C++ loading libraries and dll from specific file?

Faced the problem of loading libraries from a specific file.
Connected SFML to the project, everything works great.
There is a main.cpp and sfml.h file, how can I make sure that when loading a class from a function (in the sfml.h file), the libraries themselves with dll files are loaded, and not entirely in the project? Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2015-08-15
@hocksten

If I understand correctly, we are talking about late binding? Classes from DLLs are not loaded "just like that", the scheme is as follows:
Preparation:
Make an exportable function in the dll that will return a pointer to an instance of the class interface.
Usage:
Load dll - LoadLibrary()
Find the creation function for the given class - GetProcAddress()
Call the creation function.
Work with the class by pointer.
All this will work stably only if the dll and the application are created by the same compiler with the same settings.

H
Hocksten, 2015-08-15
@Hocksten

I am writing an engine in smfl and c++ cli.
By pressing a button, a window is created with the parameters width, height, window name.
When the button is pressed, the window is created normally, and after closing the form itself (project) is closed. I noticed that the console (sfml) opens along with the form loading, I think that because of this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question