Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>DLLs in C# and C++ are somewhat different, especially in how they're used. C# uses assemblies, with all sorts of metadata packed in, and hides most of the details. C++ does not, you have to tell it what is exported and how.</p> <p>Making DLLs generally consists of writing your code, then for each class or function you want to use (from outside the DLL), add this bit:</p> <pre><code>int __declspec(dllexport) function(int param); class __declspec(dllexport) object; </code></pre> <p>That will "export" the symbols, making them visible from outside the DLL. You only need to do this for ones that will be used externally, and for classes, only on the class (not each method).</p> <p>When using the DLL, you'll want to include a header that has all functions, but with <code>__declspec(dllimport)</code> notes. This will tell your code these are used from an external DLL. You need to provide the lib (created when you compiled the DLL) to the linker as an input file, and everything should line up.</p> <p>An easy way to handle that is:</p> <pre><code>#ifndef IMPORT_MYLIB # define MYLIB_API __declspec(dllexport) #else # define MYLIB_API __declspec(dllimport) #endif int MYLIB_API function(); </code></pre> <p>When using the DLL in another app, simply <code>#define IMPORT_MYLIB</code> and the header will be set up appropriately.</p> <p>For C#, you need to simply create a library with public classes, then add it as a reference to the other project. You can then use classes from it and the two files will automatically be linked together (much simpler, but not always as clean as C++'s method).</p> <p>Note that DLLs are Microsoft-specific, and there are quite a few little details that may interest you later on (how imports are searched for and such).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload