(Windows) Dynamic Linking

White, Jim (ITD) Jim.White at DEFRA.GSI.GOV.UK
Mon Nov 10 16:21:45 CET 2003


Dynamic linking has made life much easier for me. 

My front-end apps are typically written in VB. Using the GMP dll's involves
2 hassles in this case:

   1.  I need to write a function declaration for each and every function I
will call (it's just a matter of making a module called GMP.bas instead of
"gmp.h", but it's tedious work)

   2.  I can't call the GMP dll directly because VB can't (sorry, "won't")
make cdecl calls, and I don't want to have to monkey about with the GMP
"make" procedures, so I have to use a "wrapper" DLL which accepts stdcall
calls from VB and makes the corresponding cdecl calls to GMP. 

But with a simple ASM routine which can make cdecl calls, and can be passed
a function pointer, everything becomes simpler.

I no longer need the wrapper DLL, nor do I need DLL function declarations -
I have a simple VB class called "GMPfunction", and now I can do something
like this:

   Dim MPF_INIT as GMPfunction
   MPF_INIT.Name = "__gmp_mpz_init"
   ...
   ...
   MPF_INIT.Call mpf1   ' i.e. call mpf_init(mpf1)

He, he, I guess all you "C" programmers out there are probably laughing or
crying at this, but it works for me! ;)


Dr Memory



Department for Environment, Food and Rural Affairs (Defra)

This email and any attachments is intended for the named recipient only. Its
unauthorised use, disclosure, storage or copying is not permitted. If you have
received it in error, please destroy all copies and inform the sender. Whilst this
email and associated attachments will have been checked for known viruses
whilst within Defra systems we can accept no responsibility once it has left our
systems. Communications on Defra's computer systems may be monitored
and/or recorded to secure the effective operation of the system and for other
lawful purposes.



More information about the gmp-discuss mailing list