[Gmsh] 答复: Having problems linking gmsh sdk libraries

Li Longhui lilonghui at hotmail.com
Sat Aug 4 05:59:02 CEST 2018


Hi Max,

I was a little busy recently and sorry for late response.

I followed your instructions, but still with the same errors.

Please let me describe in detail what I tried.

What I downloaded:

http://www.gmsh.info/bin/Windows/gmsh-git-Windows64-sdk.zip
http://www.gmsh.info/bin/Windows/gmsh-git-Windows32-sdk.zip

The contents under the sdk libraires are shown below, no libgmsh.dll file exists.
[cid:image007.jpg at 01D42BEA.79476250]

What I prepared:

A very simple t1.cpp fie under the sdk root directory

[cid:image010.jpg at 01D42BEA.79476250]

What I tried with gmsh.h
Using gmsh.h

1)     Built in the mingw cmd window, with linkage errors

[cid:image008.png at 01D42BE4.F6FEF970]

This is expected as no libgmsh.dll exists from the distributed sdks.

2)     Copied gmsh-3.0.dll to libgmsh.dll, and did it again, same linkage errors

3)     Copied libgmsh.dll.a to libgmsh.dll, and did it again, same linkage errors


Renaming gmsh.h_cwrap  to gmsh.h

1)     Built in the mingw cmd window, with many linkage errors

[cid:image011.png at 01D42BE7.00D29EF0]

This is expected as no libgmsh.dll exists from the distributed sdks.

2)     Copied gmsh-3.0.dll to libgmsh.dll, and did it again, same linkage errors

3)     Copied libgmsh.dll.a to libgmsh.dll, and did it again, same linkage errors

Basing in information above, I am suspecting that the sdks are not correctly shipped, at least no libgmsh.dll file was shipped.

I hope with the information above, it will be helpful addressing this issue.

Please feel free to let me know in case of any questions.

Thanks Much
Longhui

发件人: Max Orok [mailto:morok at mevex.com]
发送时间: 2018年7月30日 21:37
收件人: Li Longhui <lilonghui at hotmail.com>
抄送: gmsh at onelab.info
主题: Re: [Gmsh] Having problems linking gmsh sdk libraries

Hi Longhui,

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:

cd /gmsh-git-Windows64-sdk
g++ t1.cpp -Iinclude -Llib -lgmsh

Please note I copied t1.cpp to the top level directory above bin, include, lib, share.
-I specifies the include directory, -L the dll directory, and -l the actual dll to link.

Perhaps you can try with cl.exe on the command line with the corresponding flags?

Max




On Sun, Jul 29, 2018 at 9:16 PM, Li Longhui <lilonghui at hotmail.com<mailto:lilonghui at hotmail.com>> wrote:
Hi Max,

Thank you for your quick feedbacks.

I followed your advice trying with the wrap file but it behaved same.

I did more research with findings below.

On windows, to release a dynamic library, three types of files are to be released.

1)     The header file             .h

In this file declarations of APIs will be described, such as

gmsh::initialized()
      this file can be included in source files using APIs within.


2)     The linkage file             .lib
This file tells in linkaging stage which .dll file and which APIs should be linkaged and accordingly will be called during execution.
This file will always be generated together with the .dll file.
Actually there is some tool from mingw that will generating .lib file by extracting information from .dll file


3)     The executable file       .dll

This is the actual executable file and used only during execution stage.

Following the findings above, I was not able to find the corresponding .lib file from the .dll file.

As this is a generic issue, I am wondering if someone can help.

Please feel free to let me know in case of any issues.

Thanks Much,
Longhui

发件人: Max Orok [mailto:morok at mevex.com<mailto:morok at mevex.com>]
发送时间: 2018年7月30日 5:34
收件人: Li Longhui <lilonghui at hotmail.com<mailto:lilonghui at hotmail.com>>; gmsh at onelab.info<mailto:gmsh at onelab.info>
主题: Re: [Gmsh] Having problems linking gmsh sdk libraries

Hello Longhui,

Not a VS expert but have you tried using the cwrap versions of these files?
I got it to work on Windows with that method.
It is explained nicely here: https://gitlab.onelab.info/gmsh/gmsh/tree/master/api

The following is taken from the relevant readme.md file:

"The additional file `gmsh.h_cwrap' redefines the C++ API in terms of the C API.
This is provided as a convenience for users of the binary Gmsh SDK whose C++
compiler ABI is not compatible with the ABI of the C++ compiler used to create
the SDK. To use these C++ bindings of the C API instead of the native C++ API,
simply rename `gmsh.h_cwrap' as `gmsh.h'. Note that this will lead to (slightly)
reduced performance compared to using the native Gmsh C++ API, as it entails
additional data copies between the C++ wrapper, the C API and the native C++
code."

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.
And if not, there's always Python!

Good luck!
Max Orok

On Sun, Jul 29, 2018 at 10:55 AM, Li Longhui <lilonghui at hotmail.com<mailto:lilonghui at hotmail.com>> wrote:
Greetings,

This is Longhui.

I am evaluating the gmsh sdks with C/C++ on windows, and having problems linking the SDK libraries.

I am wondering if some experts can have a look?  Thanks.

Here are what I have done

1.     In Visual Studio 2015, create a function as below



[cid:image001.png at 01D42BE4.3A168800]

2.     Configure the sdk include path and the sdk library path

[cid:image002.jpg at 01D42BE4.3A168800]

The codes can be built without compiling errors, but having linkage errors
[cid:image003.jpg at 01D42BE4.3A168800]

I have tried with both 32-bit and 64-bit sdks, and they have behaved exactly same.

Should I have the Can I have the two files
libgmsh.dll
libgmsh.lib

Do we need a libgmsh.dll and libgmsh.lib file?

Any advices will be greatly appreciated/

Thanks Much,
Longhui

_______________________________________________
gmsh mailing list
gmsh at onelab.info<mailto:gmsh at onelab.info>
http://onelab.info/mailman/listinfo/gmsh



--
Max Orok
Summer Student
www.mevex.com<http://www.mevex.com>

[图像已被发件人删除。]



--
Max Orok
Summer Student
www.mevex.com<http://www.mevex.com>

[https://docs.google.com/uc?export=download&id=1fHTIiW4OMUjQr1iOkspQ7wiEsxunoOs0&revid=0B6x5w-5zVaEjSkpwbm5oY29jbG1XMzJoYldXTmJpNGFtb3dVPQ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180804/d6692101/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 10886 bytes
Desc: image001.png
URL: <http://onelab.info/pipermail/gmsh/attachments/20180804/d6692101/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 19432 bytes
Desc: image002.jpg
URL: <http://onelab.info/pipermail/gmsh/attachments/20180804/d6692101/attachment-0005.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 24557 bytes
Desc: image003.jpg
URL: <http://onelab.info/pipermail/gmsh/attachments/20180804/d6692101/attachment-0006.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.jpg
Type: image/jpeg
Size: 426 bytes
Desc: image004.jpg
URL: <http://onelab.info/pipermail/gmsh/attachments/20180804/d6692101/attachment-0007.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image008.png
Type: image/png
Size: 14736 bytes
Desc: image008.png
URL: <http://onelab.info/pipermail/gmsh/attachments/20180804/d6692101/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image011.png
Type: image/png
Size: 12153 bytes
Desc: image011.png
URL: <http://onelab.info/pipermail/gmsh/attachments/20180804/d6692101/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.jpg
Type: image/jpeg
Size: 9194 bytes
Desc: image007.jpg
URL: <http://onelab.info/pipermail/gmsh/attachments/20180804/d6692101/attachment-0008.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image010.jpg
Type: image/jpeg
Size: 11847 bytes
Desc: image010.jpg
URL: <http://onelab.info/pipermail/gmsh/attachments/20180804/d6692101/attachment-0009.jpg>


More information about the gmsh mailing list