在窗户上制作mosquitto-auth-plug

时间:2015-08-04 11:52:55

标签: authentication plugins mqtt mosquitto

我目前正在尝试在Windows上构建mosquitto-auth-plugin,但我不确定使用哪个进程。该文档说要编辑我已经完成的config.mk文件,然后“制作”auth-plug - 这是我很震惊我试图使用GnWin& MinGW但是没有工作是否有一种方法可以在Windows上构建库,或者我可以在Linux中创建并将auth-plug.o复制到我的Windows机器上吗?

2 个答案:

答案 0 :(得分:3)

我不知道是否有人试图在Windows上构建mosquitto-auth-plug,如果可行的话,我会感到非常惊讶;作为插件的作者,我没有注意Un * x之外的可移植性,为了不提高希望,我不会。 : - )

也就是说,你不能在Windows上运行(加载)在Linux上构建的共享对象。什么是可能的,但是自从我做了类似事情以来已经过了多年,是用适当的工具链进行交叉编译。

答案 1 :(得分:0)

我使用HTTP和JWT后端为Windows构建它。

不得不修理:

  1. 将__declspec(dllexport)放入auth-plug.c中的mosquitto_auth_Xyz ...函数。
  2. 在auth-plug.c中添加了fnmatch(a,b)和strsep()的替代代码,见下文。
  3. 在log.c中我退回使用log = __ log而不是log = mosquitto_log_printf,因为我无法从libmosquitto导入函数。
  4. 使用Visual Studio 2017 Express进行编译,并将预处理器定义_CRT_NONSTDC_NO_DEPRECATE和_CRT_SECURE_NO_WARNINGS设置到位。
  5. 代码工作正常!

    对于auth-plug.c中的fnmatch(a,b)和strsep(),将#include改为:

    import nltk
    File = open("C:\\Desktop\\English_words_Filtered_golve.csv")
    lines = File.read()
    sentences = nltk.sent_tokenize(lines)
    nouns = []
    
    for sentence in sentences:
         for word,pos in nltk.pos_tag(nltk.word_tokenize(str(sentence))):
             if (pos == 'NN' or pos == 'NNP' or pos == 'NNS' or pos == 'NNPS'):
                 nouns.append(word)
    
    print(nouns)
    
相关问题