Re: [Lazarus] Using a component OBJ file in Lazarus?

2018-06-12 Thread Sven Barth via Lazarus
Michael Schnell via Lazarus  schrieb am Di.,
12. Juni 2018, 15:25:

> On 12.06.2018 14:06, Sven Barth via Lazarus wrote:
> > The dongle code would also be linked if it would be in a dynamic
> > package and Lazarus would support them.
> Sorry, I seem not to be have been clear.
>
> The (potential) problem I want to provide a solution for is: not to link
> the Dongle code in the Lazarus IDE executable. (But have it usable in
> the compiled user application.)
> (Delphi does this by using the dynamic linking for the package the
> Delphi IDE uses, but this is of no concern when doing Lazarus.)
>

No. Delphi does *not* solve this by using dynamic linking. If a package is
installed in the IDE (no matter whether it is Delphi or Lazarus) its code
becomes part of the running process (for Delphi when the package is loaded
at IDE start, for Lazarus during compilation and linking).
The execution of the dongle code is only prevented if the developer of the
component checked whether the design mode is active and does not execute
the dongle code in that case (or the component is not used, because a
project is loaded that does not use the component).

Regards,
Sven
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Using a component OBJ file in Lazarus?

2018-06-12 Thread Michael Schnell via Lazarus

On 12.06.2018 14:06, Sven Barth via Lazarus wrote:
The dongle code would also be linked if it would be in a dynamic 
package and Lazarus would support them.

Sorry, I seem not to be have been clear.

The (potential) problem I want to provide a solution for is: not to link 
the Dongle code in the Lazarus IDE executable. (But have it usable in 
the compiled user application.)
(Delphi does this by using the dynamic linking for the package the 
Delphi IDE uses, but this is of no concern when doing Lazarus.)


That is why I suggest to avoid the Dongle code in the package 
altogether, and have it only dynamically linked late (on request, which 
only is supposed top occur with the user application).


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Using a component OBJ file in Lazarus?

2018-06-12 Thread Sven Barth via Lazarus
Michael Schnell via Lazarus  schrieb am Di.,
12. Juni 2018, 11:48:

> Hence the dongle code will be linked in with the IDE and might (or might
> not) provide problems.
>

The dongle code would also be linked if it would be in a dynamic package
and Lazarus would support them.
The important point is what a component does while in design mode (e.g. the
OpenGL component does not initialize a OpenGL context in design mode). As
long as the component does not use the dongle code while in design mode
then nothing happens no matter whether it is linked dynamically or
statically.

Regards,
Sven

>
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Using a component OBJ file in Lazarus?

2018-06-12 Thread Michael Schnell via Lazarus

On 12.06.2018 11:30, Sven Barth via Lazarus wrote:
 Only because the code is part of a package that's loaded by the 
Delphi IDE does not mean that it also is one in the final Delphi 
program. Delphi package distributions more often than not also contain 
the DCU for static linking.


Of course you are correct that in Delphi a package can be linked 
dynamically to the IDE (it can't be linked statically, as the IDE never 
is recompiled), but statically in the final executable.


But Lazarus does not provide dynamic linking to the IDE in such a way. 
That is why the IDE needs to be recompiled when adding a package with 
"design time stuff". (IMHO this is not harmful at all.)


Am I wrong supposing that this means that the package will be statically 
linked to both the IDE and the executable, and hence it content will be 
linked in with both ?


AFAIU, there are means to control how the code is executed at runtime 
and how at design time, but this does not affect linking.


Hence the dongle code will be linked in with the IDE and might (or might 
not) provide problems.


-Michael
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Using a component OBJ file in Lazarus?

2018-06-12 Thread Sven Barth via Lazarus
Michael Schnell via Lazarus  schrieb am Di.,
12. Juni 2018, 10:37:

>
> On 11.06.2018 21:03, Bo Berglund via Lazarus wrote:
> > On Mon, 11 Jun 2018 10:23:44 +0200, Michael Schnell via Lazarus <
> lazarus@lists.lazarus-ide.org> wrote:
> >
> >
> > You want to compile some 3rd party Dongle code in the IDE ?
> >
> > That is more than weired !
> >
> > Sorry, I don't really know what you mean here...
> > What is the reason for this comment?
> > Unlike Delphi it seems like when one wants to add components to the
> > development IDE palette in Lazarus one has actually to *rebuild* the
> > IDE, there seems to be no otehr way...
> >
>
> As fpc/Lazarus dos not (yet) provide run time packages, and IMHO it will
> ask for major problems when compiling the Lazarus IDE to contain the
> Dongle code, I suppose your best option is to replace the Dongle .OBJ
> file by a small pascal function and use this to build your package to
> allow it for compiling the IDE (providing the design time stuff) and the
> user program (providing the run time stuff).
>
> Now you need to "fake" the runtime package behavior by doing the said
> small pascal function in a way that it dynamically (not in the startup
> code !) loads and then uses a dll .
>
> The dll would be done in a way that it just forwards the call to the
> functions provided by Dongle .OBJ to same, and statically links to it.
>

Would you please stop spreading nonsense? Only because the code is part of
a package that's loaded by the Delphi IDE does not mean that it also is one
in the final Delphi program. Delphi package distributions more often than
not also contain the DCU for static linking.

Regards,
Sven

>
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Using a component OBJ file in Lazarus?

2018-06-12 Thread Michael Schnell via Lazarus


On 11.06.2018 21:03, Bo Berglund via Lazarus wrote:

On Mon, 11 Jun 2018 10:23:44 +0200, Michael Schnell via Lazarus 
 wrote:


You want to compile some 3rd party Dongle code in the IDE ?

That is more than weired !

Sorry, I don't really know what you mean here...
What is the reason for this comment?
Unlike Delphi it seems like when one wants to add components to the
development IDE palette in Lazarus one has actually to *rebuild* the
IDE, there seems to be no otehr way...



As fpc/Lazarus dos not (yet) provide run time packages, and IMHO it will 
ask for major problems when compiling the Lazarus IDE to contain the 
Dongle code, I suppose your best option is to replace the Dongle .OBJ 
file by a small pascal function and use this to build your package to 
allow it for compiling the IDE (providing the design time stuff) and the 
user program (providing the run time stuff).


Now you need to "fake" the runtime package behavior by doing the said 
small pascal function in a way that it dynamically (not in the startup 
code !) loads and then uses a dll .


The dll would be done in a way that it just forwards the call to the 
functions provided by Dongle .OBJ to same, and statically links to it.


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus