S
S
sddvxd2018-05-01 14:37:33
C++ / C#
sddvxd, 2018-05-01 14:37:33

What does this line (modifier in the macro) mean?

Hello! Please explain how such a MYLIBAPI modifier will affect the functions?
#define MYLIBAPI extern "С" __declspec(dllimport)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Bogdan, 2018-05-01
@sddvxd

The macro simplifies the import from the dll into the program. Wherever you use "MYLIBAPI", the dll import directive will expand.
extern "C" means to use simple function signature generation (C style) when getting object files. In particular, it prevents the C++ compiler from "decorating" (or "beautifying") a function name with additional characters when working with a DLL
Example:
extern "C" __declspec(dllimport)double AddNumbers(double a, double b);
in your case, you can write
MYLIBAPI double AddNumbers(double a, double b);

G
GavriKos, 2018-05-01
@GavriKos

It's not a modifier. This is the name of the macro. And then there is his body. Now everywhere in the code MYLIBAPI will be replaced by the body.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question