Thanks, it works (except, it can't change literals in example)
What do you mean?
- what do SafeLoadLibrary? I read it save FPU state.
It stores the FPU and SSE state on x86 processors before loading the library and restores it afterwards.
- how share GetMem/FreeMem along dll's/so's ?
If you simply pass a memory to a library, but the library does
not free it (or the other way round) then it will work without problems. However if you have memory that is allocated in e.g. the program, but freed in the library then you need to use a shared memory manager. You can either have both parts use the C memory manager by using the
cmem unit or you can pass the program's memory manager to the library (by using
GetMemoryManager and
SetMemoryManager). A common memory manager is also required if you want to pass managed types like
AnsiString or dynamic arrays between the program and the library. Interfaces work without a common memory manager however.
- is possible export classes and use it?
Short answer: no
Long answer: as long as you don't rely on the RTTI (which includes
is and
as operators as well as exceptions) you can use them. To use them in a safe way requires working dynamic packages support which is still a Work In Progress.