malisipi / mui

A Cross-Platform UI Library
https://malisipi.github.io/mui/
Apache License 2.0
105 stars 10 forks source link

Can't build C-bindings #21

Closed milen-prg closed 1 year ago

milen-prg commented 1 year ago

Windows 10 Pro 64bit

I installed V with TCC. So I try to use mui c-bindings with command:

v -shared -cc tcc mui.v -o mui.dll

but it returns error:

builder error: 'commdlg.h' not found

malisipi commented 1 year ago

Did you install windows api header for TCC?

If you not, you can follow the How to use TCC on Windows instruction at FAQ to install

After installing, recompile with v -shared -cc tcc -d no_backtrace mui.v -o mui.dll

Also i recommend using GCC or Clang instead of TCC to get optimized builds.

milen-prg commented 1 year ago

Apologize, now I add the folder winapi and the command: v -shared -cc tcc -d no_backtrace mui.v -o mui.dll successfully made mui.dll

But, when I try the example:

C:\Users\mlap\Documents\m\Installs\Vlang\mui-main\c_bindings>C:\v\thirdparty\tcc\tcc test.c mui.dll -o test.exe In file included from test.c:1: mui.h:1: warning: #warning "The API is unstable and a lot of thing will be changed in future. Please don't use in real-world application before stable-release."

The test.exe was generated, but when I start it, the Windows message appears - the test.exe stop work and wait to close. Same errors appears usually at some memory leaks.

P.S. Will consider to use GCC, but it is some problematic on Windows (MSYS2 is not usable in this case).

milen-prg commented 1 year ago

I reinstall all with GCC and all works fine.

malisipi commented 1 year ago

TCC has some problems about creating shared libraries. The executables uses the shared library that made by TCC can crash sometimes. I'm glad to hear everything worked fine with GCC. If you have not another problem about the shared library, you can close the issue.