sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.57k stars 266 forks source link

undefined reference to `SciterAPI@0' when using -DSTATIC_LIB #160

Open l0hn opened 6 years ago

l0hn commented 6 years ago

Hi,

I'm trying to static link sciter and getting "undefined reference to `SciterAPI@0'".

Is there anything further that needs to be done other than set STATIC_LIB and add the .lib to ldflags?

c-smile commented 6 years ago

STATIC_LIB #define is used to link static lib of Sciter into your application. Public SDK does not contain such lib - you need to get access to Sciter sources to build and use static libs.

So use of sciter.dll/dylib/so is the only option with public SDK.

All static libs used by application shall share the same C/C++ runtime so static libs need to be built specifically for target environment.

l0hn commented 6 years ago

Hi,

I did recently purchase a source licence in-order to link statically so I have already compiled sciter with visual studio, however after more research it seems I cannot link this and would need to compile sciter with gcc in-order to link with the go binary that uses mingw

Is it possible to compile sciter win32 with mingw?

c-smile commented 6 years ago

Is it possible to compile sciter win32 with mingw?

I am compiling sciter on Linux using GCC so technically is should be possible. Haven't tried to do that on Windows though. MSVC produces more compact binaries so I have no motivation to use GCC on Windows nor on MacOS.

l0hn commented 6 years ago

Well, I attempted to compile with GCC out of curiosity too see what would be involved to get it working, there were unsurprisingly a large number of types undefined in the mingw headers, many for gdiplus. Not being a c++ developer I doubt I would be able to get it to compile with any validity. It's a shame as the combination of go + sciter would be perfect for creating a single static binary with a UI. Hopefully go will support msvc in the future.

pravic commented 6 years ago

https://github.com/sciter-sdk/go-sciter/issues/112#issuecomment-375025602