On Thu, Mar 13, 2008 at 11:02 PM, vijay patil <address@hidden
<mailto:address@hidden>> wrote:
It would be nice to have this change (i.e. explicitly loading the
dynamic library/shared object related to table feature in
MathProg) work on MS Windows.
I ported example on page http://linux.die.net/man/3/dlopen to
windows. We will need to use ifdefs at come places (loading,
unloading, and getting function address), but actual function
invocation is OS independent. I have tested program below on
Windows XP and it works as expected.
I forgot to post to reference links (for code) yesterday, here :
About Dynamic-Link Libraries
http://msdn2.microsoft.com/en-us/library/ms681914(VS.85).aspx
<http://msdn2.microsoft.com/en-us/library/ms681914%28VS.85%29.aspx>
LoadLibrary Function
http://msdn2.microsoft.com/en-us/library/ms684175(VS.85).aspx
<http://msdn2.microsoft.com/en-us/library/ms684175%28VS.85%29.aspx>
-------------------------------
Example just demonstrates how to invoke simple function (like cos). I
wonder how to define a pointer to a structure (that is) defined in
dynamic lib/shared object.
For example, in file glpsql.c (in libglpk-4.27) we have:
MYSQL *con; //connection
MYSQL_RES *res; //result
These pointers are used to store return values of MySQL functions like
mysql_init. Structures MYSQL and MYSQL_RES are defined in
libmySQL.dll. I think those pointers (con, res) have to be converted
into void pointers, unless there is better way. I tried some simple C
examples using void*, and seems to work.
--
Vijay Patil