<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><span class=""><br class=""></span><span class=""></span><span class="">Dear </span><span class="">Longhui,</span><div class=""><span class=""><br class=""></span></div><div class=""><span class="">The import library is currently named libgmsh.dll.a. So </span>to compile the "simple.cpp" example with Microsoft Visual Studio 2017 in the</div><div class=""><span class=""><div class="">Visual Studio shell, you would do:</div><div class=""><br class=""></div><div class="">C:\gmsh-git-Windows64-sdk> ren include\gmsh.h_cwrap include\gmsh.h</div><div class="">C:\gmsh-git-Windows64-sdk> cl /Iinclude share\doc\gmsh\demos\api\simple.cpp lib\libgmsh.dll.a</div><div class="">C:\gmsh-git-Windows64-sdk> cd lib</div><div class="">C:\gmsh-git-Windows64-sdk\lib> ..\simple.exe</div><div class=""><br class=""></div><div class="">Christophe</div><div class=""><br class=""></div></span><span class=""><blockquote type="cite" class="">On 30 Jul 2018, at 15:36, Max Orok <<a href="mailto:morok@mevex.com" class="">morok@mevex.com</a>> wrote:<br class=""><br class="">Hi Longhui, <br class=""><br class="">This might not be super helpful but here is the compiler command to get t1.cpp to compile fresh out of the 64bit SDK using MinGW:<br class=""><br class="">cd /gmsh-git-Windows64-sdk<br class="">g++ t1.cpp -Iinclude -Llib -lgmsh<br class=""><br class="">Please note I copied t1.cpp to the top level directory above bin, include, lib, share. <br class="">-I specifies the include directory, -L the dll directory, and -l the actual dll to link. <br class=""><br class="">Perhaps you can try with cl.exe on the command line with the corresponding flags?<br class=""><br class="">Max<br class=""><br class=""><br class=""><br class=""><br class="">On Sun, Jul 29, 2018 at 9:16 PM, Li Longhui <<a href="mailto:lilonghui@hotmail.com" class="">lilonghui@hotmail.com</a>> wrote:<br class="">Hi Max,<br class=""><br class=""> <br class=""><br class="">Thank you for your quick feedbacks.<br class=""><br class=""> <br class=""><br class="">I followed your advice trying with the wrap file but it behaved same.<br class=""><br class=""> <br class=""><br class="">I did more research with findings below.<br class=""><br class=""> <br class=""><br class="">On windows, to release a dynamic library, three types of files are to be released.<br class=""><br class="">1) The header file .h<br class=""><br class="">In this file declarations of APIs will be described, such as<br class=""><br class="">gmsh::initialized()<br class=""><br class=""> this file can be included in source files using APIs within.<br class=""><br class=""> <br class=""><br class="">2) The linkage file .lib<br class=""><br class="">This file tells in linkaging stage which .dll file and which APIs should be linkaged and accordingly will be called during execution. <br class=""><br class="">This file will always be generated together with the .dll file.<br class=""><br class="">Actually there is some tool from mingw that will generating .lib file by extracting information from .dll file<br class=""><br class=""> <br class=""><br class="">3) The executable file .dll<br class=""><br class="">This is the actual executable file and used only during execution stage.<br class=""><br class=""> <br class=""><br class="">Following the findings above, I was not able to find the corresponding .lib file from the .dll file.<br class=""><br class=""> <br class=""><br class="">As this is a generic issue, I am wondering if someone can help.<br class=""><br class=""> <br class=""><br class="">Please feel free to let me know in case of any issues.<br class=""><br class=""> <br class=""><br class="">Thanks Much,<br class=""><br class="">Longhui<br class=""><br class=""> <br class=""><br class="">发件人: Max Orok [mailto:morok@mevex.com] <br class="">发送时间: 2018年7月30日 5:34<br class="">收件人: Li Longhui <lilonghui@hotmail.com>; gmsh@onelab.info<br class="">主题: Re: [Gmsh] Having problems linking gmsh sdk libraries<br class=""><br class=""> <br class=""><br class="">Hello Longhui, <br class=""><br class=""> <br class=""><br class="">Not a VS expert but have you tried using the cwrap versions of these files?<br class=""><br class="">I got it to work on Windows with that method.<br class=""><br class="">It is explained nicely here: https://gitlab.onelab.info/gmsh/gmsh/tree/master/api<br class=""><br class=""> <br class=""><br class="">The following is taken from the relevant readme.md file:<br class=""><br class=""> <br class=""><br class="">"The additional file `gmsh.h_cwrap' redefines the C++ API in terms of the C API.<br class="">This is provided as a convenience for users of the binary Gmsh SDK whose C++<br class="">compiler ABI is not compatible with the ABI of the C++ compiler used to create<br class="">the SDK. To use these C++ bindings of the C API instead of the native C++ API,<br class="">simply rename `gmsh.h_cwrap' as `gmsh.h'. Note that this will lead to (slightly)<br class="">reduced performance compared to using the native Gmsh C++ API, as it entails<br class="">additional data copies between the C++ wrapper, the C API and the native C++<br class="">code."<br class=""><br class=""> <br class=""><br class="">The libgmsh.dll is essential for sure, not sure about the .lib. I also had to put the gmsh-3.0.dll in the same folder as my executable.<br class=""><br class="">And if not, there's always Python!<br class=""><br class=""> <br class=""><br class="">Good luck!<br class=""><br class="">Max Orok<br class=""><br class=""> <br class=""><br class="">On Sun, Jul 29, 2018 at 10:55 AM, Li Longhui <lilonghui@hotmail.com> wrote:<br class=""><br class="">Greetings,<br class=""><br class=""> <br class=""><br class="">This is Longhui.<br class=""><br class=""> <br class=""><br class="">I am evaluating the gmsh sdks with C/C++ on windows, and having problems linking the SDK libraries.<br class=""><br class=""> <br class=""><br class="">I am wondering if some experts can have a look? Thanks.<br class=""><br class=""> <br class=""><br class="">Here are what I have done<br class=""><br class="">1. In Visual Studio 2015, create a function as below<br class=""><br class=""> <br class=""><br class=""><span id="cid:image001.png@01D427E5.4CA25C90"><image001.png></span><br class=""><br class="">2. Configure the sdk include path and the sdk library path<br class=""><br class=""><span id="cid:image002.jpg@01D427E5.4CA25C90"><image002.jpg></span><br class=""><br class=""> <br class=""><br class="">The codes can be built without compiling errors, but having linkage errors<br class=""><br class=""><span id="cid:image003.jpg@01D427E5.4CA25C90"><image003.jpg></span><br class=""><br class=""> <br class=""><br class="">I have tried with both 32-bit and 64-bit sdks, and they have behaved exactly same.<br class=""><br class=""> <br class=""><br class="">Should I have the Can I have the two files<br class=""><br class="">libgmsh.dll<br class=""><br class="">libgmsh.lib<br class=""><br class=""> <br class=""><br class="">Do we need a libgmsh.dll and libgmsh.lib file?<br class=""><br class=""> <br class=""><br class="">Any advices will be greatly appreciated/<br class=""><br class=""> <br class=""><br class="">Thanks Much,<br class=""><br class="">Longhui<br class=""><br class=""><br class="">_______________________________________________<br class="">gmsh mailing list<br class="">gmsh@onelab.info<br class="">http://onelab.info/mailman/listinfo/gmsh<br class=""><br class=""><br class=""><br class=""><br class="">-- <br class=""><br class="">Max Orok<br class=""><br class="">Summer Student<br class=""><br class="">www.mevex.com<br class=""><br class=""><span id="cid:image004.jpg@01D427E5.4CA25C90"><image004.jpg></span><br class=""><br class=""><br class=""><br class=""><br class="">-- <br class="">Max Orok<br class="">Summer Student<br class="">www.mevex.com<br class=""><br class=""><img src="https://docs.google.com/uc?export=download&id=1fHTIiW4OMUjQr1iOkspQ7wiEsxunoOs0&revid=0B6x5w-5zVaEjSkpwbm5oY29jbG1XMzJoYldXTmJpNGFtb3dVPQ" width="164" height="42" class=""><br class="">_______________________________________________<br class="">gmsh mailing list<br class="">gmsh@onelab.info<br class="">http://onelab.info/mailman/listinfo/gmsh<br class=""></blockquote></span><br class=""><div class="">
<div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">— </div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Prof. Christophe Geuzaine<br class="">University of Liege, Electrical Engineering and Computer Science <br class=""><a href="http://www.montefiore.ulg.ac.be/~geuzaine" class="">http://www.montefiore.ulg.ac.be/~geuzaine</a><br class=""><br class="">Free software: http://gmsh.info | http://getdp.info | http://onelab.info</div></div>
</div>
<br class=""></div></body></html>