简体   繁体   中英

Windows compile instructions for mod_go.so

Is it possible to compile mod_go.c successfully and produce the Apache module (mod_go.so) for GOLANG in Windows environment?

Unfortunately i can not find any detailed instructions such as type of C++ compiler, apache version etc as well as what steps i have to follow?

Regards

Probably that is not possible , but I leave you to check.

Go plugins are only supported on Linux. So if you absolutely need to code Apache modules in Go (which requires dynamic loading of shared object produced by the Go compiler, that is a plugin coded in Go), you'll better switch to Linux. BTW the linker model of Windows is very different from Linux, so it won't change easily and I won't be surprised that Go won't have plugin on Windows for a few years.

Linux dlopen(3) (actually a POSIX feature ) and its shared libraries ( ELF shared objects, containing position-independent code) are very different from Windows LoadLibrary and DLL s.

Read Levine's Linkers and Loaders book and (for Linux) Drepper's paper How To Write Shared Libraries

So if you badly need to write this year (eg before the end of 2018) a plugin in Go to be used by Apache, I strongly recommend switching your Apache server machine to Linux.

BTW, it looks like your mod_go don't use Go plugins (but communicate with some external process, I leave you to study its source code, I only glanced into it) Perhaps using FastCGI could be simpler, since Go has FastCGI support. Probably Windows' Apache could be configured to talk to some FastCGI application (notice that FastCGI is not CGI ).

(I don't know Windows, never used it, but read a few things about its weird -and IMHO inferior to Unix- linking model)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM