Hello List,
I'm binding FAM/GAM to Pascal, and I do it in two flavors: static and dynamic linking (depending on the define). I found out that I require to link two variables with the library.
How can dynamic link a variable using FPC ?
Thanks,
Ido

Mailing lists / fpc-pascal / 2007-10
7 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hello List,
I'm binding FAM/GAM to Pascal, and I do it in two flavors: static and dynamic linking (depending on the define). I found out that I require to link two variables with the library.
How can dynamic link a variable using FPC ?
Thanks,
Ido
on unix you can use GetProcedureAddress in dynlibs to get any exported symbol (according to the docs, at least). dunno about windows, though.
maybe you need to patch the library source to add helper functions that return those variables.
henry
I'm binding FAM/GAM to Pascal, and I do it in two flavors: static and dynamic linking…
If you're talking about a variable in a dynamically linked lib declaring like this
myvar: integer; cvar; external;should do. If you want to load a library dynamically at runtime using LoadLibrary/dlload, I don't know.
HTH,
Marc
Yes, that's what I was asking :)
Thanks,
Ido
You cannot do this with a single construct; You need a pointer in the case of a dynamically loaded library.
Michael.
I'm not sure that I understand. can you please point me to an example ?
Michael.
Thanks,
Ido
You cannot do this with a single construct; You need a pointer in the case of a dynamically loaded library. > > I'm not sure that I understand. can you please point me to an example ?
He means it depends on whether you are using:
DLL bound dynamically at program runtime
DLL bound statically at program load time
A static DLL is when you use:
procedure blah; external somedll;Whereas a dynamic DLL is:
LoadLibrary(somedll);
GetProcAddress('blah');If you are using static binded DLL, then you can use the cvar.. but if using dynamic binded DLL then you have to figure up a different solution.