When the compiler sees a function declared as __declspec(dllimport), it generates references to the function via a decorated name. The name decoration used follows the pattern __imp__<function_name>. For example, the _commit function is referenced as __imp___commit.
Efter hvad jeg kan se er det for at undgå en eller anden linkererror ?!?
The dllexport and dllimport storage-class modifiers export and import functions, data, and objects to and from a DLL. These modifiers, or attributes, explicitly define the DLL’s interface to its client, which can be the executable file or another DLL. Declaring functions as dllexport eliminates the need for a module-definition (.DEF) file, at least with respect to the specification of exported functions. Note that dllexport replaces the __export keyword.
The declaration of dllexport and dllimport uses extended attribute syntax:
__declspec( dllexport ) void func();
Alternatively, to make your code more readable, you can use macro definitions:
Det der undrer mig er at man ikke skal angive fra hvilken dll man henter funktionen!? Og hvad så med dlleksport, putter den funktioner i en ny dll fil?
Nej, men det må linkeren jo finde ud af; eller vill den jo brokke sig :) Det er fordi funktionen ligger i C runtime biblioteket, som den altdi linker med...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.