Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is meant by 'Exported function' in c++?

Tags:

c++

dll

dllexport

Recently I started to work with c++. I heard about exported functions but not sure what it means.

so my questions are about:

  1. What is exported function?
  2. Is there any difference between normal function and exported function? if yes, what is it?
  3. How is it related with dll?
like image 302
user3770833 Avatar asked Jan 06 '15 05:01

user3770833


1 Answers

  1. what is exported function ?

When you program with modules (pieces of code) you need to call in some module a function which was defined in some other module. Exporting is relative to that process. In C/C++ if you want to declare a function to use it without defining it in a source file, you should use the keyword "extern". In the file where that function is defined you have nothing special to make, by defaults things at global scope are automatically exported.

  1. Is there any difference between normal function and exported function? if yes , what it is ?

Nothing special, except that the later are visible at link time.

  1. how it is related with dll ?

See, http://msdn.microsoft.com/en-us/library/a90k134d.aspx for DLL and function export for DLL. In such a case you must declare which function should be exported.

like image 182
Jean-Baptiste Yunès Avatar answered Oct 24 '22 10:10

Jean-Baptiste Yunès