Dean

 

Although you’re better off reading a C or C++ first-principles book, there’s a simple project / article on the CodeProject which gives a recipe for the simplest C-callable DLLs but I think you will need to get a not-free (but still cheap) version of Visual Studio 2005 so that you can build it using C++ (not C#). I don’t think there is an Express version of C/C++ available.

 

The article is called “Super Easy DLL” by Greg Ellis written December 2004 for Visual C++ 6.0 - www.codeproject.com/dll/EasyDLL.asp

Of course, the example given in this very short article is trivial.

If you go this path, read the comments / warnings to the article (at the bottom), since this isn’t the panacea for all DLL development.

 

But, as has been pointed out several times here by the experts, Delphi is just super super easy for C-callable convention DLLs compared with even this article.

IL Thomas
GeoSciSoft  - Perth, Australia


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of McGowan Dean
Sent: Friday, May 19, 2006 4:30 PM
To: mapinfo-l@lists.directionsmag.com
Subject: [MI-L] MapBasic C# dll

 

I have written a dll in C# express edition and would like to call its functions from MapBasic. Here are my scripts:

 

C#

using System;

using System.Collections.Generic;

using System.Text;

using System.Data;

 

namespace MapInfoTools

{

    public class MIFunctions

    {

        public double GPS_X()

        {

            //Return test value for now.

            return 1;

        }

        public double GPS_Y()

        {

            //Return test value for now.

            return 2;

        }

    }

}

 

MB

Declare Function GPS_X Lib "C:\Projects\C#\MapInfoTools\MapInfoTools\obj\Release\MapInfoTools.dll" as float

print GPS_X()

 

My MB application compiles correctly but produces error 342 (“External library does not contain GPS_X…”) at runtime. Can anybody point out where I am going wrong?

Cheers, Dean

 

 

 

Dean McGowan

GIS Injengör

Teknik & Service

Upplands Väsby kommun

[EMAIL PROTECTED]

 

Tel. 08-590 97563

Mobil 073-910 4563

 

_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to