for the form
TForm1 = class(TForm) Button1: TButton; edit1: TEdit; procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; procedure NEwEditText( var edt: TEdit ); stdcall; external 'project1.dll'; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); begin NEwEditText( edit1 ); end;
for the dll
library project1; {$mode objfpc}{$H+} uses Classes, { you can add units after this } interfaces, Controls, StdCtrls ; procedure NEwEditText( var edt: TEdit ); begin edt.Text := 'hellllllllloooooooooo !! '; end; exports NEwEditText; begin end.
try to add var to your procedure in the dllDo not even try to add such code to a shared library (possibly used from other languages too) Cyrax is right.
try to add var to your procedure in the dllDo not even try to add such code to a shared library (possibly used from other languages too) Cyrax is right.
Either use PChar or (in case you only use fpc for both library and main program, ) wait for dynamic package support.
Cyrax is very right, do not try to get around this.
try to add var to your procedure in the dllDo not even try to add such code to a shared library (possibly used from other languages too) Cyrax is right.
Either use PChar or (in case you only use fpc for both library and main program, ) wait for dynamic package support.
Cyrax is very right, do not try to get around this.
For me It works well.
For me It works well.
Anybody else would like to help me, please?The problem is with dynamic strings. They use reference counting and are managed by the memory мanager. Unfortunately, the main program and library use their own copy of the memory мanager. The string allocated in the memory мanager by the library will be released by the main program's memory мanager.
Anybody else would like to help me, please?The problem is with dynamic strings. They use reference counting and are managed by the memory мanager. Unfortunately, the main program and library use their own copy of the memory мanager. The string allocated in the memory мanager by the library will be released by the main program's memory мanager.
Possible solution:
1. Types without reference counting: ShortString, PChar, PUnicodeChar, or WideString (for Windows only).
2. Use sharemem both in the library and in the program. Its main purpose is to make a single memory Manager (i.e. the one compiled in it).
Is CodeTyphon better than Lazarus and do you recommend it?
CodeTyphon makes cross compiling lots easier. Lazarus/FPC can do cross compiling, the documentation is there. But learning it is not easy. I spent many weeks just to be able to cross compile from Linux to Windows.Really ? I am sure I posted my notes about how to setup cross compiling from Ubuntu64 to Win32, Win64 and Linux32. It was just collected from other notes in the wiki. Maybe it needs to live in the Short Tutorial Page you asked about ? https://forum.lazarus.freepascal.org/index.php/topic,48264.msg347466.html#msg347466
....
Lazarus has LAMW, OPM, bug tracker. And the community has a lot of experience users, they share their experience, codes and tricks. I always learn something new just simply reading the posts on the forum.
I am sure I posted my notes about how to setup cross compiling from Ubuntu64 to Win32, Win64 and Linux32.
Wow... it works in CT but no in Lazarus. Really?
Anybody else would like to help me, please?