On 15.09.2012 07:10, Rolf Grunsky wrote:
On 12-09-14 10:39 AM, leledumbo wrote:
Currently, if we have a library project, there's no way to test it
without
creating 2nd project which is an application. Should Lazarus implement
something like V$ does? i.e. when "Run" is executed on a library project,
the IDE then ask for an executable to run (the executable uses the
library,
so it will step into the library eventually). I have no idea whether gdb
supports something like this or not.


It's been a very long time since I looked at this, and this is specific
to Windows. An exe and dll have the same basic structure, the difference
is that an exe can not export entry points and part of the startup will
initialize the stack and data segments. On the other hand, any procedure
called in a dll will assume that the stack pointer and segment registers
have been already set up. Also, I believe that there is only a single
entry point in an exe. Windows does provide a method to run a dll as a
program but I would assume that you have to pass the procedure in the
dll that you want to run. As I said this is from vague memory so the
details are fuzzy. At a minimum, to run a procedure in the dll you will
need some code to set up stack and data segments.



Note: You can export symbols from a program (this even works with FPC), but you should only do a LoadLibrary for that application from a library that is loaded by that application to avoid that the entry point is called ;) The only program that I'm aware of that utilizes this is the kernel itself: ntoskrnl.exe is linked to by device drivers.

Regards,
Sven

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to