Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-06

Problem with dynamic libraries

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Adrian Veith

Hi,

i have written a dll (pasForNeko) in delphi / windows which can be called from the haxe/neko language, in order to use existing object pascal code from this language. now I try to port this to fpc and linux and run into some problems:

1. I can't compile even the simplest library from fpc (i use 2.1.4) in linux

library testdll;

uses
SysUtils,

  Classes;
procedure HalloWelt;
begin
end;
exports
  HalloWelt;
begin
end.

causes an: Error while linking
in linux when compiled with

fpc testdll.pas

in windows it works with fpc

2. the delphi/windows version of the pasForNeko works fine. the same code compiled with fpc in windows fails to run with an exception.

Are there known pitfalls when compiling dlls in fpc which are called from applications written in C ?

Thanx,

Adrian.

Adrian Veith
to Leonardo M. Ram�

no - that was not the problem. I have my linux running in a coLinux session and it seems that the linker fails, when the file is in a windows drive, even as root. other programms don't have problems to read or write to this drive.

but there is still a strange problem with the dynamic library:

the code compiles with fpc fails, when one of the units have some initialization code. When I move this code to an extra procedure and call it later it works.

Is there a difference, when the initialization code of an dll is called between delphi and fpc ?

thanks,

Adrian.

Show quoted text 25 lines
Replace procedure HalloWelt; with procedure HalloWelt; cdecl; > procedure HalloWelt; > begin > end; > > Leonardo M. Ramé http://leonardorame.blogspot.com ____________________________________________________________________________________ Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/ _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal