<div dir="ltr"><br><br>On 6 August 2018 at 13:22, Ben Coman <<a href="mailto:btc@openinworld.com" target="_blank">btc@openinworld.com</a>> wrote:<br>> and ends up with 4 link errors (and 6600 warnings)<br>> Pharo.exe LNK1120 - 1 unresolved external<br>> Pharow.exe LNK1120 - 1unresolved external<br>> sqMain.c.obj LNK2019 - unresolved external symbol _imp_osvm_main referenced in function main<br>> sqWin32Main.c.obj LNK2019 - unresolved external symbol _imp_osvm_main referenced in function WinMain<br>><br>> I do see osvm_main is defined here...<br>> <a href="https://github.com/ronsaldo/opensmalltalk-vm/blob/be7b1c03/platforms/minheadless/common/sqVirtualMachineInterface.c#L618" target="_blank">https://github.com/ronsaldo/<wbr>opensmalltalk-vm/blob/<wbr>be7b1c03/platforms/<wbr>minheadless/common/<wbr>sqVirtualMachineInterface.c#<wbr>L618</a><br>><br>> but I'm stuck, I don't understand why its looking for "_imp_osvm_main"<br><br><div><div><div>I see that sqMain.c (<a href="https://github.com/ronsaldo/opensmalltalk-vm/blob/be7b1c03/platforms/minheadless/common/sqMain.c">https://github.com/ronsaldo/opensmalltalk-vm/blob/be7b1c03/platforms/minheadless/common/sqMain.c</a>)</div><div>only defines a single function... <br>    #include "OpenSmalltalkVM.h"<br></div><div>    int</div><div>    main(int argc, const char **argv)</div><div>    {</div><div>        return osvm_main(argc, argv);</div><div>    }</div><div><br></div><div>To check that the osvm_main function is available to be linked, at the end of CmakeLists.txt I see...</div><div>  # Build the VM executable(s)</div><div>  add_executable(${VM_EXECUTABLE_NAME} platforms/minheadless/common/sqMain.c)</div><div>  target_link_libraries(${VM_EXECUTABLE_NAME} ${VM_LIBRARY_NAME} ${VM_DEPENDENCIES_LIBRARIES})</div><div><br></div><div>Using <a href="https://stackoverflow.com/questions/9298278/cmake-print-out-all-accessible-variables-in-a-script">https://stackoverflow.com/questions/9298278/cmake-print-out-all-accessible-variables-in-a-script</a></div><div>I found...</div><div>  VM_LIBRARY_NAME=PharoVMCore </div><div>where that library is defined</div><div>  VM_CORE_LIBRARY_TYPE=STATIC </div><div>  add_library(${VM_LIBRARY_NAME} ${VM_CORE_LIBRARY_TYPE} ${VM_SOURCES} ${VM_INTERNAL_PLUGIN_SOURCES})</div><div><br></div><div>and an inspection of PharoVMCore.lib (using 7zip to expand it) </div><div>shows it contains function osvm_main symbol, but not the "_imp_" prefixed symbol.</div><div><br></div><div>Regarding the "_imp_" prefix, the next to last comment in this thread</div><div>  * <a href="https://software.intel.com/en-us/forums/intel-c-compiler/topic/673427">https://software.intel.com/en-us/forums/intel-c-compiler/topic/673427</a>,<br></div></div></div><div>

<div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">gave a hint about the __declspec() needing to be dllexport instead of dllimport.</div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">The declaration for osvm_main() in OpenSmalltalkVM.h is effectively...</div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">

<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><a href="https://github.com/ronsaldo/opensmalltalk-vm/blob/be7b1c03/include/OpenSmalltalkVM.h#L43-L55">https://github.com/ronsaldo/opensmalltalk-vm/blob/be7b1c03/include/OpenSmalltalkVM.h#L43-L55</a></span>

<br></div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">   #       define OSVM_VM_EXPORT __declspec(dllexport)<br></div><div><div>   #       define OSVM_VM_IMPORT __declspec(dllimport)</div></div><div><div>   #ifdef BUILD_VM_CORE</div><div>   #   define OSVM_VM_CORE_PUBLIC OSVM_VM_EXPORT</div><div>   #else</div><div>   #   define OSVM_VM_CORE_PUBLIC OSVM_VM_IMPORT</div><div>   #endif</div></div>

<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;background-color:rgb(255,255,255)">    OSVM_VM_CORE_PUBLIC OSVMError osvm_main(int argc, const char **argv);</div><br class="gmail-Apple-interchange-newline"><br>So the following change to sqMain.c fixes the link error...</div><div>    #define BUILD_VM_CORE<div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">    #include "OpenSmalltalkVM.h"<br></div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">    int</div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">    main(int argc, const char **argv)</div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">    {</div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">        return osvm_main(argc, argv);</div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">    }</div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">and similar for sqWin32Main.c.</div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> </div>

</div></div>