Hello Karl,

> I have a MapBasic programming question.  I am trying to link to a DLL
> but when I run my MBX I get the message "Unable to load library abc.dll.
> Unable to link to external library abc.dll".  Has anyone come across
> this before?  I heard from MapInfo that only 32 bit dll's are supported
> and this is a 32 bit dll so that shouldn't be the problem.

This could be a number of things but the most common problems are;

1) Your functions are not being declared for export properly. I use the following 
definition for 
C/C++ functions:

#define DllExport       __declspec( dllexport )

Then declare your functions like this;

DllExport int
MyFunction(int Arg1)
// etc...

2) Your functions are being exported with C++ mangled names which are not matched by 
the 
calling MB program. Remember that C++ messes around with function names internally so 
that 
function overloading (the ability to have the 'same' function have several variants 
handling 
different argument types). Your functions must have "C linkage". This is not to say 
you cannot 
use C++ features in the function themselves - you just cannot have more than one 
function with 
that name. To specify C linkage, use extern "C" { }. For example;

extern "C"
{
   DllExport int
   MyFunction(int Arg1)
   {
      return Arg1;      // Dummy function
   }
}

Hope this helps.

Regards,
Warren Vick
Europa Technologies Ltd, U.K.
http://www.europa-tech.com
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to