Making a .DLL

I have a lot of experience programming in Visual Basic, however I would like to take dozens of functions that I have written in VB and make them into a C++ dll.  Now, I am just learning C++ and don't know the slightest bit about what I am doing.  If anyone could point me to a sample project with several different types of functions and return values, either on the web or email it to me ( that would be great.

If I can see a sample, I should be able to modify it to fit my needs.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
headerAuthor Commented:
I have taken the supplied demo from the msdn and added a function called 'Test'.

Here is my Select.def:

LIBRARY   Select

    StartSelection      @2
    UpdateSelection     @3
    EndSelection        @4
    ClearSelection      @5
    Test              @6

Here is my Select.h:

int APIENTRY StartSelection(HWND, MPOINT, LPRECT, int);
int APIENTRY UpdateSelection(HWND, MPOINT, LPRECT, int);
int APIENTRY ClearSelection(HWND, LPRECT, int);
int APIENTRY Test(long);

and here is Select.c

    long message)
      return message;

When I call this function from visual basic, it always returns -2328.  I'm not sure what I am doing wrong to make it return the wrong value.  It seems as though the value I pass to it from VB is not getting there, possibly from a wrong declaration somewhere?

Also, I put this line at the top of Select.c:
#include <iostream.h>

I tried to use this line in the Test function:
cout << "Hello World";

However, when I compiled it said 'cout' was an undeclared identifier.  What am I doing wrong there?
>When I call this function from visual basic, it always returns -2328.

I don't use Visual Basic. You need to find out what the error code means.

>However, when I compiled it said 'cout' was an undeclared identifier.  What am I doing wrong there?

Your source file is in C language (.c). But cout is C++ stuff. Use printf instead.
headerAuthor Commented:
I don't think I am getting an error message back.  If I say, for example:

return 12345;

VB returns the correct number (12345), the problem occurs when I change it to:

return message;

message is the parameter that was passed to the function, so I am wondering if there is something I did wrong to make the parameter not get passed or interpreted correctly.
So, what did you get?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.