Two DLL questions.

I'll split the points if need be.
First, I need to export an enumerator from a dll.  How is this done?  In the source and in an ODL file.
Second, in an odl file, how do you specify default function parameters?  The API has, among others, two default parameters of type int.  In the calling application, if I don't specify them, the call goes to the dll with 0 values for the int parameters.  What I want is for those parameters to be left off completely.  I tried to specify the defaults in the odl file, but it won't take them, or I'm doing it wrong.
The dll is written in C++, but is used from VB apps.  It is VB friendly so far, and I like to keep it that way.

The API looks like this
__declspec(dllexport) int _stdcall FunctionName(const char x[], const char y[], const char z[], const int i = lcDefault, const int j = ccDefault);
In the ODL file it looks like this
int _stdcall FunctionName(LPSTR x, LPSTR y, LPSTR z, int i, int j);
       
kpcapelAsked:
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.

abancroftCommented:
What do you mean by "an enumerator"? Could you be a bit more precise?

Default parameters in ODL: use defaultvalue(value). e.g.
interface QueryDef : IUnknown
{
    HRESULT OpenRecordset( [in, defaultvalue(DBOPENTABLE)]
    LONG Type,
    [out,retval] Recordset **pprst);
}
//  Type is now known to be a LONG type (good for browser in VBA and
//  good for a C/C++ programmer) and has a default value of
//  DBOPENTABLE
 
0
kpcapelAuthor Commented:
I was referring to a standard enum.  Microsoft has plenty in various dll's.

typedef enum TAnimals
{
      aDog,
      aCat,
      aFish,
      aMoose
}EAnimals;
0
abancroftCommented:
You can't export it from the DLL in the same way you export a function. But you can add it to the ODL file (& therefore the type library).

Use:
enum [tag ]
{
    identifier [=integer-value ]
    [ , ... ]
}

e.g.
typedef enum {Monday=2, Tuesday, Wednesday, Thursday, Friday} workdays;
0

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
kpcapelAuthor Commented:
Guess I should have checked the platform SDK a little better.
Thanks for your answer.
0
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
C++

From novice to tech pro — start learning today.