简体   繁体   English

Windows编译mod_go.so的说明

[英]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? 是否可以成功编译mod_go.c并在Windows环境中为GOLANG生成Apache模块(mod_go.so)?

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? 不幸的是,我找不到任何详细的说明,例如C ++编译器的类型,Apache版本等以及必须遵循的步骤?

Regards 问候

Probably that is not possible , but I leave you to check. 可能这是不可能的 ,但我让您检查。

Go plugins are only supported on Linux. Go插件仅在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. 因此,如果您绝对需要在Go中编写Apache模块的代码(这需要动态加载 Go编译器生成的共享对象,即Go编码的插件 ),则最好切换到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. 顺便说一句,Windows的链接器模型与Linux有很大不同,因此它不会轻易更改,并且Go几年不会在Windows上安装插件也不会令我感到惊讶。

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. Linux dlopen(3) (实际上是POSIX 功能 )及其共享库(包含位置无关代码的ELF共享对象)与Windows LoadLibraryDLL完全不同。

Read Levine's Linkers and Loaders book and (for Linux) Drepper's paper How To Write Shared Libraries 阅读Levine的Linkers and Loaders一书和(对于Linux)Drepper的论文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. 因此,如果您非常需要在今年(例如,在2018年底之前)编写Go插件以供Apache使用,则我强烈建议您将Apache服务器计算机切换为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. 顺便说一句,您的mod_go不使用Go插件(但是与某些外部进程进行通信,我留给您研究它的源代码,我只看了一下它)也许使用FastCGI可能更简单,因为Go具有FastCGI支持。 Probably Windows' Apache could be configured to talk to some FastCGI application (notice that FastCGI is not CGI ). Windows的Apache可能被配置为与某些FastCGI应用程序通信(请注意,FastCGI 不是 CGI )。

(I don't know Windows, never used it, but read a few things about its weird -and IMHO inferior to Unix- linking model) (我不知道Windows,从未使用过Windows,但阅读了一些有关Windows怪异的信息,以及次于Unix链接模型的恕我直言)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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