[fpc-pascal] CMEM experiences in DLL

2006-01-14 Thread L505
In linux I get a segmentation fault at the very end of an executable program 
when
using cmem.pp in a DSO and executable combination. (simple hello world not even
calling the function - just importing it itself is the problem). If the imported
function is commented out,
there is no segmentation fault.

When using cmem in regular executable elf programs and not calling a library 
that
uses cmem, the cmem works without trouble.

On MS Windows using cmem does not seem to cause segmentation fault on simple 
hello
world dll and exe combination program.

I tried fpc version 2.0.2 and 2.0.0 and 2.1.1 with all the same behavior. I 
guess
I'll file a simple bug report since any function doesn't work (even when not 
using
ansistrings). Actually the program seems to run fine, i.e. the functions work 
and the
programs run through till the end, just at the very end of the program you get a
segmentation fault. Probably something to do with a variable being freed. I 
don't
think it's the
  SetMemoryManager (OldMemoryManager);
function in cmem's finalization section, because I commented that line out and 
it
still gave segmentation fault.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] RES: FreePascal in a FreeBSD

2006-01-14 Thread Marco van de Voort
> Thank you very much, Marco! You really helped me a lot.
> 
> Pierre: you can use de BaseUnix.GetEnvironmentVariable almost the same like
> you use Windows.GetEnvironmentVariable in Delphi.

baseunix.fpgetenv it is :-)

baseunix mostly contains Unix calls prefixed with "fp" to avoid unnecessary
nameclashes

> Now I'm looking for correspondents for these Windows APIs in the FreePascal:
>  - LoadLibrary (Linux: dlopen)
>  - FreeLibrary (Linux: dlclose)
>  - GetProcAddress (Linux: dlsym)
> 
> Can somebody help me?

Use unit dynlibs. These calls are abstracted in that unit to work over all
OSes that support such functionality.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal