Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Okay, with your help and a fair bit of Google, this finally works!</p> <p>Here's a run-down, in case it helps anyone else in the future:</p> <ul> <li>Use the <a href="http://www.flounder.com/ultimateheaderfile.htm" rel="nofollow">Ultimate Header File</a> for a blueprint of how to create the header file. </li> <li>It is important to understand how compiling as C will not name mangle, whereas compiling as C++ will. </li> <li>It also appears that DevC++ has a neat <code>BUILDING_DLL</code> flag but Visual Studio requires you to create a definition in your main.c file.</li> <li><code>__stdcall</code> does something called 'name decoration' that is different from name mangling but will still change your function name. Thanks to @slugonamission for giving me a pointer about this. It finally clicked when using dumpbin.exe, as suggested by @HansPassant.</li> <li>so, switching to <code>__cdecl</code> manages to avoid name decoration, and compiling in C (or using <code>extern</code> and compiling in C++) avoids name mangling.</li> <li>and the dll will finally give me CalcGraph as a valid entry point!</li> </ul> <p>The Implicit / Explicit dll linking is a very important distinction. Implicit linking requires a .lib file, the .dll and perhaps also a .h file. Explicit linking is what I was after - you can get away with the .dll by itsself. Thanks to @squelos for the link explaining this.</p> <p>And last but not least: </p> <p>In the dll:</p> <pre><code>extern _COMPILING_ void __cdecl CalcGraph(PanelParameters *, Calculations *); </code></pre> <p>And in the VB code:</p> <pre><code>Imports System.Runtime.InteropServices Private Declare Sub CalcGraph Lib "myDLL.dll" (ByRef params As Parameters, _ ByRef calcs As Calculations) </code></pre> <p>And it finally worked!</p>
    singulars
    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.
 

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