Re: [lazarus] compiling a DLL

2006-07-07 Thread Vincent Snijders

Christian Budde wrote:

Vincent Snijders schrieb:


Christian Budde wrote:


Back to my problem:

i found out that adding: Application.Initialize avoids the access 
violation but introduces a bounds check error. Anyway Delphi works 
without the need to add Application.Initialize so it must be possible.


I've already compared the *constructor* Application.Create and found 
out, that Delphi does not create a handle if it is a library. In LCL 
this part looks quite different. Also after a search on the forum I 
found out, that in Delphi the "Application" of the host is used (or 
at least its handle) instead of creating a new Application.


And I think that is the heart of the problem. I don't think it is 
possible to share the Application object yet, fpc needs to support 
packages (like .bpl) for that so, that the LCL can be shared.


But maybe I am wrong, you have researched more than I have.


Is there anyone on the list who can tell me more? Are there already 
plans for sharing the Application object or support of packages? With 
this option it would be also possible to add components at real time, 
like it is possible with Delphi.


Support for packages is planned for fpc 2.2
http://www.freepascal.org/wiki/index.php/Road_map

Vincent

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-07 Thread Christian Budde

Vincent Snijders schrieb:

Christian Budde wrote:

Back to my problem:

i found out that adding: Application.Initialize avoids the access 
violation but introduces a bounds check error. Anyway Delphi works 
without the need to add Application.Initialize so it must be possible.


I've already compared the *constructor* Application.Create and found 
out, that Delphi does not create a handle if it is a library. In LCL 
this part looks quite different. Also after a search on the forum I 
found out, that in Delphi the "Application" of the host is used (or 
at least its handle) instead of creating a new Application.


And I think that is the heart of the problem. I don't think it is 
possible to share the Application object yet, fpc needs to support 
packages (like .bpl) for that so, that the LCL can be shared.


But maybe I am wrong, you have researched more than I have.
Is there anyone on the list who can tell me more? Are there already 
plans for sharing the Application object or support of packages? With 
this option it would be also possible to add components at real time, 
like it is possible with Delphi.


   Christian

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Vincent Snijders

Christian Budde wrote:

Back to my problem:

i found out that adding: Application.Initialize avoids the access 
violation but introduces a bounds check error. Anyway Delphi works 
without the need to add Application.Initialize so it must be possible.


I've already compared the *constructor* Application.Create and found 
out, that Delphi does not create a handle if it is a library. In LCL 
this part looks quite different. Also after a search on the forum I 
found out, that in Delphi the "Application" of the host is used (or at 
least its handle) instead of creating a new Application.




And I think that is the heart of the problem. I don't think it is 
possible to share the Application object yet, fpc needs to support 
packages (like .bpl) for that so, that the LCL can be shared.


But maybe I am wrong, you have researched more than I have.

Vincent

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Christian Budde




Back to my problem:

i found out that adding: Application.Initialize avoids the
access violation but introduces a bounds check error. Anyway Delphi
works without the need to add Application.Initialize so it
must be possible.

I've already compared the constructor Application.Create
and found out, that Delphi does not create a handle if it is a library.
In LCL this part looks quite different. Also after a search on the
forum I found out, that in Delphi the "Application" of the host is used
(or at least its handle) instead of creating a new Application.

Just let me know if anyone knows more,

    Christian




Re: [lazarus] compiling a DLL

2006-07-06 Thread Christian U.

> I cant' find the bug... do you have a number?

 0001052

Christian

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Alexandre Leclerc

2006/7/6, Alexandre Leclerc <[EMAIL PROTECTED]>:

2006/7/6, Christian Ulrich <[EMAIL PROTECTED]>:
> >> you can "dock" another window to an form ... so you can use any
> >> application you want in this way.
>
> >Well, this is not completely working in lazarus yet (under win32 you
> can't dock a form in another without having mouse/focus problems), so it
> would be much more hard in some other languages. (This was working too
> in Delphi 3 :) )
>
> I have added an notice to the bugreport how to solve this as
> "workaround" for your applications
> I use this n 3 applications from me without problems ...

I cant' find the bug... do you have a number?


I found bug 0001052. I'll try the hack, hoping that the issue will be
solved natively one day.



--
Alexandre Leclerc




--
Alexandre Leclerc

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Alexandre Leclerc

2006/7/6, Christian Ulrich <[EMAIL PROTECTED]>:

>> you can "dock" another window to an form ... so you can use any
>> application you want in this way.

>Well, this is not completely working in lazarus yet (under win32 you
can't dock a form in another without having mouse/focus problems), so it
would be much more hard in some other languages. (This was working too
in Delphi 3 :) )

I have added an notice to the bugreport how to solve this as
"workaround" for your applications
I use this n 3 applications from me without problems ...


I cant' find the bug... do you have a number?

--
Alexandre Leclerc

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Alexandre Leclerc

2006/7/6, Christian Budde <[EMAIL PROTECTED]>:

Christian Iversen schrieb:
> Can you give more information about the problem? Is there a crash? A
> segmentation fault? Does nothing happen? etc
>
Access violation read of address 0003
> In any circumstance, I think you should join #lazarus-ide on
> irc://irc.freenode.org, to discuss this further.
>
On the web forum, they told me to go to this mailinglist and the
mailinglist tells me to go to the IRC channel...

Christian U. schrieb:
> i hjave written an framework for this, in my applications an xml sheme is
> passed to the application and describes the control elements of the
> configuration dialog (simelar to lfm) the application build the dialog.
> when the user interacts with the controlelements the application calls an
> function to tells the dll what has changed.
Ok, but what if the host application is closed source of a third party.
They made the rules, how to make a GUI and they decided to encapsulate
everything in a DLL. I can tell at least 3 examples for that and this
works very well in Delphi and C/C++.


This was my previous point.

--
Alexandre Leclerc

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Alexandre Leclerc

2006/7/6, Christian U. <[EMAIL PROTECTED]>:

lazarus is no delphi, and delphi isnt crossplatform.
librarys (as the name says) are for sharing functions, the ui is always
platform dependend librarys not ...


Yes I know that laz isn't delphi. Yet, we talk about technical
possibilities here. If others can do it, if I can do it in c/c++, ...
why not in fpc? (I'm kind of rethorical here, not bashing on.)


and i dont know an case where an whole application needs to used by another.
and if this fall is the case, why dont use an normal executable ?


I stated a case about using different languages. A DLL in pascal,
another application using this dll in any other language. Some
languages do not have the hability to do that much and DLLs comes
handy, even as UI extensions.


you can "dock" another window to an form ... so you can use any application
you want in this way.


Well, this is not completely working in lazarus yet (under win32 you
can't dock a form in another without having mouse/focus problems), so
it would be much more hard in some other languages. (This was working
too in Delphi 3 :) )

I do not have all the required skills to send patches on deep-down lcl
issues. I'd like to. :)

Best regards.

--
Alexandre Leclerc

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Christian Budde

Christian Iversen schrieb:
Can you give more information about the problem? Is there a crash? A 
segmentation fault? Does nothing happen? etc
  

Access violation read of address 0003
In any circumstance, I think you should join #lazarus-ide on 
irc://irc.freenode.org, to discuss this further.
  
On the web forum, they told me to go to this mailinglist and the 
mailinglist tells me to go to the IRC channel...


Christian U. schrieb:

i hjave written an framework for this, in my applications an xml sheme is
passed to the application and describes the control elements of the
configuration dialog (simelar to lfm) the application build the dialog.
when the user interacts with the controlelements the application calls an
function to tells the dll what has changed.
Ok, but what if the host application is closed source of a third party. 
They made the rules, how to make a GUI and they decided to encapsulate 
everything in a DLL. I can tell at least 3 examples for that and this 
works very well in Delphi and C/C++.


Kind regards,

   another Christian

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Christian U.
lazarus is no delphi, and delphi isnt crossplatform.
librarys (as the name says) are for sharing functions, the ui is always
platform dependend librarys not ...

and i dont know an case where an whole application needs to used by another.
and if this fall is the case, why dont use an normal executable ?
you can "dock" another window to an form ... so you can use any application
you want in this way.

Christian

- Original Message - 
From: "Alexandre Leclerc" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, July 06, 2006 5:32 PM
Subject: Re: [lazarus] compiling a DLL


> We can do it in Delphi. In fact I was able to have an EXE and a DLL of
> the complete and same application; it was very handy when someone
> desired to integrate the whole software in is own application, whether
> it be in pascal or not. For myself, ui is functionnality, especially
> when dealing with other languages.
>
> Is it because the compiler is not mature enought on this specific issue
for dll?
>
> 2006/7/6, Christian U. <[EMAIL PROTECTED]>:
> > why you want to make a showmessage from an dll ? thats bad.
> > the only think i know where you need forms in dll´s are configure
dialogs
> > for plugins but this can
> > also be solved with other methods.
> >
> > librarys should add functionality to your program ... not ui
>
> -- 
> Alexandre Leclerc
>
> _
>  To unsubscribe: mail [EMAIL PROTECTED] with
> "unsubscribe" as the Subject
>archives at http://www.lazarus.freepascal.org/mailarchives
>
>
>

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Christian U.
> In my app I would like to show a dialog where the user can select some
> items from a list. The items are calculated within the DLL. After the user
> selected which items it wants to see the selected items are passed on to
> the main app.

i hjave written an framework for this, in my applications an xml sheme is
passed to the application and describes the control elements of the
configuration dialog (simelar to lfm) the application build the dialog.
when the user interacts with the controlelements the application calls an
function to tells the dll what has changed.
multiplatform, multiapplication ...

Christian

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Christian Iversen
On Thursday 06 July 2006 17:32, Alexandre Leclerc wrote:
> We can do it in Delphi. In fact I was able to have an EXE and a DLL of
> the complete and same application; it was very handy when someone
> desired to integrate the whole software in is own application, whether
> it be in pascal or not. For myself, ui is functionnality, especially
> when dealing with other languages.
>
> Is it because the compiler is not mature enought on this specific issue for
> dll?

It should have nothing to do with the compiler, at least.

It could have something to do with GUI code - someone from this mailing list 
should be able to give you more detailed help.

One possible problem is the use of different memory managers across modules 
(exe, dll). This means that if your DLL deallotes memory from the main 
program (or vice versa), your program will crash.

Can you give more information about the problem? Is there a crash? A 
segmentation fault? Does nothing happen? etc

In any circumstance, I think you should join #lazarus-ide on 
irc://irc.freenode.org, to discuss this further.

-- 
Regards,
Christian Iversen

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Alexandre Leclerc

We can do it in Delphi. In fact I was able to have an EXE and a DLL of
the complete and same application; it was very handy when someone
desired to integrate the whole software in is own application, whether
it be in pascal or not. For myself, ui is functionnality, especially
when dealing with other languages.

Is it because the compiler is not mature enought on this specific issue for dll?

2006/7/6, Christian U. <[EMAIL PROTECTED]>:

why you want to make a showmessage from an dll ? thats bad.
the only think i know where you need forms in dll´s are configure dialogs
for plugins but this can
also be solved with other methods.

librarys should add functionality to your program ... not ui


--
Alexandre Leclerc

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread dhkblaszyk
Christian,

I faced the same problem a while ago and (temporarily) gave up on it. You
mention there are other methods to use configure dialogs from dll. What
methods would that be?

In my app I would like to show a dialog where the user can select some
items from a list. The items are calculated within the DLL. After the user
selected which items it wants to see the selected items are passed on to
the main app.

Darius

> why you want to make a showmessage from an dll ? thats bad.
> the only think i know where you need forms in dll´s are configure dialogs
> for plugins but this can
> also be solved with other methods.
>
> librarys should add functionality to your program ... not ui
>
> regards
> Christian
>   - Original Message -
>   From: Christian Budde
>   To: lazarus@miraclec.com
>   Sent: Thursday, July 06, 2006 3:53 PM
>   Subject: [lazarus] compiling a DLL
>
>
>   Hello,
>
>   I've been trying to compile a DLL with no luck the code looks like this:
>
>   library DLLTest;
>
>   uses Forms,
>LCLType,
>LCLClasses,
>LCLIntf,
>interfaces,
>Dialogs;
>
>   function Main(audioMaster: Pointer): Pointer; cdecl; export;
>   begin
>ShowMessage('Test');
>   end;
>
>   exports Main name 'main';
>
>   end.
>
>   It works fine if I don't use the ShowMessage(). But what's wrong with
> this function. I already included several files (see above), but nothing
> seems to work. I've tried it with all the latest Lazarus versions
> (currently 0.9.17) and FPC 2.0.2 (I've heard that there was a problem
> with FPC, but not what the exact problem was.
>
>   The error is reproducable, but I hadn't been able to debug the DLL to
> see what the problem is. Please help,
>
>   Christian
>


_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] compiling a DLL

2006-07-06 Thread Christian U.



why you want to make a showmessage from an dll ? 
thats bad. 
the only think i know where you need forms in dll´s 
are configure dialogs for plugins but this can 
also be solved with other methods.
 
librarys should add functionality to your program 
... not ui
 
regards
Christian

  - Original Message - 
  From: 
  Christian Budde 
  To: lazarus@miraclec.com 
  Sent: Thursday, July 06, 2006 3:53 
  PM
  Subject: [lazarus] compiling a DLL
  Hello,I've been trying to compile 
  a DLL with no luck the code looks like this:library DLLTest;uses 
  Forms, LCLType, 
  LCLClasses, LCLIntf, 
  interfaces, Dialogs;function 
  Main(audioMaster: Pointer): Pointer; cdecl; 
  export;begin ShowMessage('Test');end;exports 
  Main name 'main';end.It works fine if I don't use the 
  ShowMessage(). But what's wrong with this function. I already included several 
  files (see above), but nothing seems to work. I've tried it with all the 
  latest Lazarus versions (currently 0.9.17) 
  and FPC 2.0.2 (I've heard that there was a 
  problem with FPC, but not what the exact problem was.The error is 
  reproducable, but I hadn't been able to debug the DLL to see what the problem 
  is. Please help,    
Christian