ProfiLab DLL mit Visual Studio

Antworten
Udo_Olaf
Beiträge: 33
Registriert: Samstag 18. September 2010, 12:15

ProfiLab DLL mit Visual Studio

Beitrag von Udo_Olaf » Samstag 18. September 2010, 12:28

Hallo,

da ich mit Visual Studio arbeite möchte ich gerne damit eine DLL für ProfiLab schreiben.

Dazu habe ich den Beispiel-Code für den DevC++ Compiler in VS übernommen.
Leider passiert erst mal gar nichts. Wenn ich die Export Funktionen als __cdecl definiere,
dann sehe ich die Anzahl der Ein/Ausgänge und alle erkannten Exports.
Sobald ich im Dialog Ok klicke, dann wird ProfiLab sofort beendet.

Wenn ich wie im Beispiel Code alle Funktionen als __stdcall definiere,
dann passiert -wie bereits oben erwähnt- gar nichts.

Hat jemand schon mal erfolgreich eine DLL in VS erzeugt?
Ein Beispiel Projekt wäre sehr hilfreich.

Grüße

Udo_Olaf

Udo_Olaf
Beiträge: 33
Registriert: Samstag 18. September 2010, 12:15

Re: ProfiLab DLL mit Visual Studio

Beitrag von Udo_Olaf » Sonntag 19. September 2010, 11:02

Hallo zusammen,

das "Problem" habe ich gelöst. Wenn man die Methoden als _stdcall definiert, dann muss man auch
in einer .def Datei den Export explizit beschreiben. Das war mein "Problem".

Jetzt läuft auch meine erste DLL mit serieller Kommunikation zwischen PL und einem Microcontroller.

Grüße

Udo_Olaf

Uncle
Beiträge: 32
Registriert: Donnerstag 12. August 2010, 21:32

Re: ProfiLab DLL mit Visual Studio

Beitrag von Uncle » Sonntag 19. September 2010, 17:57

Hi All
Udo_Olaf, is it usefull to make own .dll driver? Do it really work better or faster than PL module?

And please can You show the devC++ example?

Udo_Olaf
Beiträge: 33
Registriert: Samstag 18. September 2010, 12:15

Re: ProfiLab DLL mit Visual Studio

Beitrag von Udo_Olaf » Sonntag 19. September 2010, 18:41

Hello Uncle,

for me it is one key feature of PL to create my own DLL drivers.
But this depends on your purpose. If you are happy with the supported modules, then there is no need to do your own drivers.
I want to implement my different hardware devices like microcontrollers, measurement amplifiers, fuzzy controllers...
Most of them have special protocols which are difficult (some even impossible) to implement with the existing PL modules.

Since PL is written in Delphi, it is not very usual to write the DLL´s in C/C++. But I stopped programming in Delphi about
5 years ago and turned to C#/.NET/C++, that´s the reason for writing the DLL´s in C/C++.

The attached file is my C/C++ implementation of the counter example done in Visual Studio 2008.
The programming style of my driver is a little smarter then the original ABACOM example - enjoy...

By the way, where do you come from?

Regards

Udo_Olaf
Dateianhänge
PL_Counter_DLL.rar
(52.01 KiB) 537-mal heruntergeladen

Uncle
Beiträge: 32
Registriert: Donnerstag 12. August 2010, 21:32

Re: ProfiLab DLL mit Visual Studio

Beitrag von Uncle » Montag 20. September 2010, 09:55

My problem is to control rs485 net, consisting from mc's (usually atmega8a) based devices.
So I too have problems with receiving arbitrary char arrays by means of a standart PL modules.
As for sending, SendString works fine enough with my own .dll (I use devC++), but for receiving I have to use ByteEmphangen modul, and with additional .dll make char array (including 0x00, 0xFF and so on) for unswer recognition (signal is not ideal in real net!). The simulation friequensy becomes lower than 1 kHz, when I run the project. This 1 kHz simulation friequency means that I can't receive more than 1 k bytes per second. It is not enough.
So I think now if it will be better to make own .dll for work with com port input. Dll will have to receive and make all calculations - crc and so on.
Thank You for the example.
I come from Tchernogolovka, Russia. Also have some praxis in Germany - I was working for a 3 years in Kaiserslautern and Freiburg am Breslau Universities as invited professor.

Antworten

Zurück zu „DLL-Programmierung“