shlomif / black-hole-solitaire

Solvers and statistics for “Golf” solitaire, “Black Hole” solitaire, “All in a Row” solitaire and related card patience games.
http://www.shlomifish.org/open-source/projects/black-hole-solitaire-solver/
MIT License
5 stars 3 forks source link

dllimport cannot be applied to non-inline function definition #7

Closed IdrisKalp closed 1 month ago

IdrisKalp commented 1 year ago

Windows 10 64 bit, Clang GCC-like compiler with Windows SDK

This error happens also on lib.c file.

FAILED: CMakeFiles/bhs_rank_reach_prune.dir/rank_reach_prune.c.obj
D:\llvm\bin\clang.exe -DXXH_CPU_LITTLE_ENDIAN=1 -Dbhs_rank_reach_prune_EXPORTS -IE:/_/1d56ee4/black-hole-solver-1.12.0/include -IE:/_/1d56ee4/build/generated/include -IE:/_/1d56ee4/build/generated -IE:/_/1d56ee4/build -IE:/_/1d56ee4/black-hole-solver-1.12.0 -IE:/_/1d56ee4/black-hole-solver-1.12.0/xxHash-wrapper -IE:/_/1d56ee4/black-hole-solver-1.12.0/xxHash-wrapper/xxHash-0.8.1 -isystem E:/kde-build/include -O2 -g -DNDEBUG -Xclang -gcodeview -D_DLL -D_MT -Xclang --dependent-lib=msvcrt   -fvisibility=hidden -Wno-unknown-pragmas -MD -MT CMakeFiles/bhs_rank_reach_prune.dir/rank_reach_prune.c.obj -MF CMakeFiles\bhs_rank_reach_prune.dir\rank_reach_prune.c.obj.d -o CMakeFiles/bhs_rank_reach_prune.dir/rank_reach_prune.c.obj -c E:/_/1d56ee4/black-hole-solver-1.12.0/rank_reach_prune.c
E:/_/1d56ee4/black-hole-solver-1.12.0/rank_reach_prune.c:18:35: error: dllimport cannot be applied to non-inline function definition
DLLEXPORT enum RANK_REACH_VERDICT bhs_find_rank_reachability(
                                  ^
1 error generated.
shlomif commented 1 year ago

@IdrisKalp :

Which version of clang?

and it works fine with:

[shlomif@telaviv1 ~]$ /usr/bin/clang --version
clang version 15.0.7 (Fedora 15.0.7-1.fc37)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
[shlomif@telaviv1 ~]$ inxi -CSG
System:
  Host: telaviv1.shlomifish.org Kernel: 6.1.13-200.fc37.x86_64 arch: x86_64
    bits: 64 Desktop: Xfce v: 4.16.1 Distro: Fedora release 37 (Thirty Seven)
CPU:
  Info: dual core model: Intel Core i3-2100 bits: 64 type: MT MCP cache:
    L2: 512 KiB
  Speed (MHz): avg: 2127 min/max: 1600/3100 cores: 1: 2955 2: 1596 3: 1597
    4: 2362
Graphics:
  Device-1: Intel 2nd Generation Core Processor Family Integrated Graphics
    driver: i915 v: kernel
  Display: x11 server: X.Org v: 1.20.14 driver: X: loaded: modesetting
    unloaded: fbdev,vesa dri: crocus gpu: i915 resolution: 1920x1080~60Hz
  API: OpenGL v: 3.3 Mesa 22.3.6 renderer: Mesa Intel HD Graphics 2000 (SNB
    GT1)
IdrisKalp commented 1 year ago

Clang 16.0.0-rc3. This is an error targeting Windows, won't happen on Linux.

shlomif commented 1 year ago

Clang 16.0.0-rc3. This is an error targeting Windows, won't happen on Linux.

Hi @IdrisKalp ! Please send me a pullreq against the master branch.

IdrisKalp commented 1 year ago

Ah, I guess you misunderstood. This bug is a Windows related, cannot happen in Linux. However, if I would fix this issue, I will send a pull rq.

shlomif commented 1 year ago

Hi,

On Wed, 01 Mar 2023 12:10:51 -0800 Idris Kalp @.***> wrote:

Ah, I guess you misunderstood. This bug is a Windows related, cannot happen in Linux. However, if I would fix this issue, I will send a pull rq.

I got that it is windows-related. But I lack access to a windws system.

Also see https://www.shlomifish.org/philosophy/culture/case-for-commercial-fan-fiction/#starved_of_employees .

--

Shlomi Fish https://www.shlomifish.org/ https://youtu.be/n6KAGqjdmsk - “Hurt Me Tomorrow”

Mephiqoleth: THERE ARE JEWS OF MANY SPECIES. Selina: Really? That’s great - can I have a Jewish lady-cat? I want one so she can mother cute little Jewish kittens. — https://www.shlomifish.org/humour/Selina-Mandrake/

Please reply to list if it's a mailing list post - https://shlom.in/reply .

IdrisKalp commented 1 year ago

I tried to make some modifications but cannot build because of source_filter.py file. Apparently it makes some modification on lib.c file that I need to patchbut I couldn't understand it, neither my Python-coder friends. Also disabling it in Cmake rules also didn't work.

shlomif commented 1 year ago

@IdrisKalp :: to tryto be constructive, please tell me how to install clang16rc6 on mswin64 on gh actions. https://duckduckgo.com/?q=clang+16+github+actions&atb=v140-1&ia=web

shlomif commented 1 year ago

@IdrisKalp - the python3 script is straightforward. can you help with clang? ping

shlomif commented 1 year ago

Closing for now to avoid clutter

IdrisKalp commented 1 year ago

Hi. Sorry for delay, was busy with something else. The problem disappear when DLLEXPORT macros are removed in lib.c and also it needs a small modification in python script to avoid error. Code compiles. In a more free time, I would like to send patches. I would like to port it and others to MSVC ecosystem.

shlomif commented 1 year ago

hi.

Hi. Sorry for delay, was busy with something else. The problem disappear when DLLEXPORT macros are removed in lib.c and also it needs a small modification in python script to avoid error. Code compiles. In a more free time, I would like to send patches.

That's great.

I would like to port it and others to MSVC ecosystem.

As a general rule, my C code is -std=gnu11 only, so patches for porting to MSVC, that make the code uglier will be rejected:

shlomif commented 1 year ago

@IdrisKalp : ping

shlomif commented 10 months ago

@IdrisKalp : ping again

IdrisKalp commented 10 months ago

Hi again. I couldn't find time for my hobbies and I still lack of time. But the idea behind porting the projects to MSVC was importing gnulib project into this. For example, when I tried it last time, I was able to build blackhole-solver by importing required functions just to the source code. Gnulib project aims to develop portable GNU C methods and it can be imported in projects requiring it. I think you may look at that if you are interested. But for now, I cannot do anything because of not having free time. Sorry.

https://www.gnu.org/software/gnulib/

shlomif commented 10 months ago

@IdrisKalp : there shouldn't be an issue building blackholesolver on mswin32/mswin64 or for it using GCC or clang.

Regarding your lack-of-time, see: https://www.shlomifish.org/humour/fortunes/show.cgi?id=smg-about-giving-back-money-and-time

IdrisKalp commented 10 months ago

Of course, there isn't any problem with mingw-w64. I need these libraries to build Kpatience with KDE Craft tool. They are its dependencies. But mingw-w64 is not compatible to build some another project, so I stick to MSVC toolchain. I'd prefer mingw-w64 over MSVC in any other case, however.

shlomif commented 10 months ago

@IdrisKalp : hi. Would it be possible to build a BHS library (static or a DLL) in a separate step?

shlomif commented 2 months ago

@IdrisKalp : hi. any news?

shlomif commented 1 month ago

Close due to non-responsiveness.