main.c: In function 'svr_InitObjects':
main.c:70:38: warning: passing argument 2 of 'oa_attach' from incompatible pointer type [-Wincompatible-pointer-types]
oa_attach(&settings->base.objects, ALL_OBJECTS, sizeof(ALL_OBJECTS) / sizeof(ALL_OBJECTS[0]));
^~~~~~~~~~~
In file included from ../include/dlmssettings.h:42:0,
from main.c:1:
../include/objectarray.h:50:10: note: expected 'gxObject ** {aka struct <anonymous> **}' but argument is of type 'const gxObject ** {aka const struct <anonymous> **}'
void oa_attach(
^~~~~~~~~
collect2.exe: error: ld returned 1 exit status
In main.c i copied the code from your examples from README.
okay, I can compile it in VS, now I need to get .so file, when I do it with gcc -fPIC -shared -o server.so main.c I've got:
main.c: In function 'serialPortThread':
main.c:2693:24: error: 'ERROR_IO_PENDING' undeclared (first use in this function)
if (ret != ERROR_IO_PENDING)
^~~~~~~~~~~~~~~~
main.c:2693:24: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'com_setCommState':
main.c:2976:24: error: 'ERROR_INVALID_FUNCTION' undeclared (first use in this function)
if (err != ERROR_INVALID_FUNCTION)
^~~~~~~~~~~~~~~~~~~~~~
Could you tell me wich command do you use to build the *.so file?
Cuz I use "gcc -fPIC -shared -o server.so main.c". I guess you may use "make ...".
And when I try to use make I get:
$ make
Assembler messages:
Fatal error: can't create obj/getopt.o: No such file or directory
make: *** [makefile:30: obj/getopt.o] Error 1
I'll write more about the project I'm making.
I have a device on Linux OS, and I'm a python software developer, actually I'm a noob in C, so my goal is to run your C server inside of mine python code. I just need something to send my data via DLMS/COSEM.
Maybe you could give me some advice or solution with those details.
Okay, we'd created .so.
But to work I also need to create .dll. So, when I try to do in I get:
Severity Code Description Project File Line Suppression State
Error (active) E0167 argument of type "unsigned short" is incompatible with parameter of type "DLMS_OBJECT_TYPE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 2187
Error (active) E0513 a value of type "int" cannot be assigned to an entity of type "DLMS_ERROR_CODE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 1756
Error (active) E0513 a value of type "short" cannot be assigned to an entity of type "DLMS_OBJECT_TYPE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 1384
Error (active) E0513 a value of type "int" cannot be assigned to an entity of type "DLMS_ERROR_CODE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 2028
Error (active) E0513 a value of type "int" cannot be assigned to an entity of type "DLMS_ERROR_CODE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 2035
Error (active) E0513 a value of type "unsigned char" cannot be assigned to an entity of type "DLMS_DATA_TYPE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 343
Error C1010 unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"' to your source? DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 3342
Could you tell me how to fix this, or maybe give me some checklist I need to follow to create a .dll?
P.S.
For .dll creating I use VS 2022, I create a proj with .dll library settings.
I used C but yesterday I tryied with C++ too. It works when I'm trying to compilate it as a server proj, but when I'm trying to build a dll it doesn't.
No. If you just open the server example you should be able to build the example right away. I just tested this with VS 2022 and it worked without problems.
Hi,
Hi,
What compiler you are using? I just try this with Visual Studio 2022 and it worked like expected.
Did you use this example?
https://github.com/Gurux/GuruxDLMS.c/tree/master/GuruxDLMSSimpleServerE…
BR,
Mikko
I use gcc compiler .
I use gcc compiler .
Yes, that example.
okay, I can compile it in VS,
okay, I can compile it in VS, now I need to get .so file, when I do it with gcc -fPIC -shared -o server.so main.c I've got:
main.c: In function 'serialPortThread':
main.c:2693:24: error: 'ERROR_IO_PENDING' undeclared (first use in this function)
if (ret != ERROR_IO_PENDING)
^~~~~~~~~~~~~~~~
main.c:2693:24: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'com_setCommState':
main.c:2976:24: error: 'ERROR_INVALID_FUNCTION' undeclared (first use in this function)
if (err != ERROR_INVALID_FUNCTION)
^~~~~~~~~~~~~~~~~~~~~~
Can I do it somehow?
Hi,
Hi,
I'll check this tomorrow with gcc (Debian 8.3.0-6) 8.3.0.
BR,
Mikko
Hi,
Hi,
This is solved. For some reason, fcntl include was removed, and that cause this.
#include <fcntl.h>
Get the latest version.
BR,
Mikko
Could you tell me wich
Could you tell me wich command do you use to build the *.so file?
Cuz I use "gcc -fPIC -shared -o server.so main.c". I guess you may use "make ...".
And when I try to use make I get:
$ make
Assembler messages:
Fatal error: can't create obj/getopt.o: No such file or directory
make: *** [makefile:30: obj/getopt.o] Error 1
I'll write more about the project I'm making.
I have a device on Linux OS, and I'm a python software developer, actually I'm a noob in C, so my goal is to run your C server inside of mine python code. I just need something to send my data via DLMS/COSEM.
Maybe you could give me some advice or solution with those details.
Hi,
Hi,
You need to create the obj and bin folders. Run those commands.
mkdir obj
mkdir bin
BR,
Mikko
Okay, we'd created .so.
Okay, we'd created .so.
But to work I also need to create .dll. So, when I try to do in I get:
Severity Code Description Project File Line Suppression State
Error (active) E0167 argument of type "unsigned short" is incompatible with parameter of type "DLMS_OBJECT_TYPE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 2187
Error (active) E0513 a value of type "int" cannot be assigned to an entity of type "DLMS_ERROR_CODE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 1756
Error (active) E0513 a value of type "short" cannot be assigned to an entity of type "DLMS_OBJECT_TYPE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 1384
Error (active) E0513 a value of type "int" cannot be assigned to an entity of type "DLMS_ERROR_CODE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 2028
Error (active) E0513 a value of type "int" cannot be assigned to an entity of type "DLMS_ERROR_CODE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 2035
Error (active) E0513 a value of type "unsigned char" cannot be assigned to an entity of type "DLMS_DATA_TYPE" DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 343
Error C1010 unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"' to your source? DLMS_Server_2 C:\Users\Kukachev\source\repos\DLMS_Server\GuruxDLMSSimpleServerExample\src\main.cpp 3342
Could you tell me how to fix this, or maybe give me some checklist I need to follow to create a .dll?
P.S.
For .dll creating I use VS 2022, I create a proj with .dll library settings.
Hi,
Hi,
Are you using C or C++? At first, you were using ANSI C, but now you are using C++.
I did build both with VS 2022 and both worked without problems.
BR,
Mikko
I used C but yesterday I
I used C but yesterday I tryied with C++ too. It works when I'm trying to compilate it as a server proj, but when I'm trying to build a dll it doesn't.
Hi,
Hi,
Your UI looks Like Visual Studio Code, not Visual Studio 2022. Am I right?
You need to compile development project as a DLL. Then you need to link that for GuruxDLMSSimpleServerExample. GuruxDLMSSimpleServerExample is an exe.
BR,
Mikko
No, my UI is Visual Studio
No, my UI is Visual Studio 2022.
So, to development as a DLL I have to create some file.cpp and export there all the functions I need. Something like this?
Hi,
Hi,
No. If you just open the server example you should be able to build the example right away. I just tested this with VS 2022 and it worked without problems.
BR,
Mikko