DLL Entry point 
Author Message
 DLL Entry point

Hi,
I've made an dll using c++. There's a function calcdays which shall be
exported.
I'm using this dll under Basic prg.

But it seems it doesn#t find the dll entry point. I've tried
__decspecl(dllexprto)
as well as AFX_EXT_CLASS with the whole class.

InBasic I  used
declare function lib "day.dll" calcdays(arguments) as integer.
Any idea?



Thu, 15 Nov 2001 03:00:00 GMT  
 DLL Entry point
Here are samples of a VC++5.0 DLL I wrote. I can call the functions from
VB5.0 with no problem.

//from the cpp file
// calc factorial
double _stdcall factorial1(__int16 j)
{  total = 1.;                  //factorial(0)=1
   for (ct = 2; ct <= j; ct++)
      total *=  ct;
   return(total);

Quote:
}

//from the def file
EXPORTS
  logbase10
  factorial1
  arccos
  harccos
  hcos
  butterworth
  chebychev
  gamma

If you use a def file listing the function, and use stdcall you'll
probably get it working.

Quote:

> Hi,
> I've made an dll using c++. There's a function calcdays which shall be
> exported.
> I'm using this dll under Basic prg.

> But it seems it doesn#t find the dll entry point. I've tried
> __decspecl(dllexprto)
> as well as AFX_EXT_CLASS with the whole class.

> InBasic I  used
> declare function lib "day.dll" calcdays(arguments) as integer.
> Any idea?



Thu, 15 Nov 2001 03:00:00 GMT  
 DLL Entry point
Part of the problem is probably the "name mangling" that C++ does to
create names that reflect overloading and class membership. One way
around this is to include the declarations under a
extern "C" {
__declspec(dllexport) int myfunction(...);

Quote:
}

then when you declare

__declspec(dllexport) int myfunction(...)

it will be declared with the name myfunction, not something like

weird link names are absolutely mandatory for handling C++
overloading, so you can't apply this to functions that have
overloads.)

If you plan to use the header file in pure C code, you need to write

#ifdef _cplusplus
extern "C" {
#endif
__declsepc(dllexport) int myfunction(...);

#ifdef _cplusplus

Quote:
}

#endif

so the header file will be syntactically correct in C and C++ and give
unmangled names in C++.
                                joe


Quote:

>Hi,
>I've made an dll using c++. There's a function calcdays which shall be
>exported.
>I'm using this dll under Basic prg.

>But it seems it doesn#t find the dll entry point. I've tried
>__decspecl(dllexprto)
>as well as AFX_EXT_CLASS with the whole class.

>InBasic I  used
>declare function lib "day.dll" calcdays(arguments) as integer.
>Any idea?

Joseph M. Newcomer

http://www3.pgh.net/~newcomer


Sat, 17 Nov 2001 03:00:00 GMT  
 DLL Entry point

Quote:

> I've made an dll using c++. There's a function calcdays which shall be
> exported.
> I'm using this dll under Basic prg.

Once more, I will advise you NOT TO USE DLLs for interlanguage
VB <-> C++ calls. Make the DLL an Automation server DLL instead.
Your life will be so much easier.

Scott



Sat, 17 Nov 2001 03:00:00 GMT  
 DLL Entry point
Actually, Scott is right. Automation servers are extremely easy to use
from VB.
                                joe



Quote:

>> I've made an dll using c++. There's a function calcdays which shall be
>> exported.
>> I'm using this dll under Basic prg.

>Once more, I will advise you NOT TO USE DLLs for interlanguage
>VB <-> C++ calls. Make the DLL an Automation server DLL instead.
>Your life will be so much easier.

>Scott

Joseph M. Newcomer

http://www3.pgh.net/~newcomer


Sat, 17 Nov 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Dll entry point

2. Dll Entry Point Missing

3. DLL entry points as expressions in watch window

4. DLL entry point logic

5. tool for dll entry point

6. DLL Entry Point Error

7. Dll entry point not found - any ideas here?

8. Regarding Dll Entry Point Missing

9. Q] DLL entry point hooking ?

10. DLL Entry Point help

11. Registering a VC++ DLL - Entry Points

12. Can't find DLL entry point ?

 

 
Powered by phpBB® Forum Software