Doubt: DLLs and calling conventions 
Author Message
 Doubt: DLLs and calling conventions

Hi all,

I am trying to create a DLL intended to be used from a certain IDE. When I
run the application, it complains it is not being able to find the function

The function has been defined as __declspec(dllexport) void __stdcall
ReadFile(const char * pFileName, char * pData). I've read the documentation
for "__stdcall", and it says the naming convention is "_" + functionName +


Any ideas?

Thanks in advance,
Best regards,

Augusto Jun Devegili



Fri, 07 Sep 2001 03:00:00 GMT  
 Doubt: DLLs and calling conventions
The article was describing name mangling in C, not C++.

VC++ mangles names for both C and C++. The fast check
is, if the first character is a question mark, it's C++.

The encoding for C++ includes additional information,
including calling convention and type of parameters.

Check the ImageHlp documentation under the
UnDecorateSymbolName API. Name mangling can be
stopped completely using a DEF file.


Quote:
>Hi all,

>I am trying to create a DLL intended to be used from a certain IDE. When I
>run the application, it complains it is not being able to find the function

>The function has been defined as __declspec(dllexport) void __stdcall
>ReadFile(const char * pFileName, char * pData). I've read the documentation
>for "__stdcall", and it says the naming convention is "_" + functionName +


>Any ideas?

>Thanks in advance,
>Best regards,

>Augusto Jun Devegili



Fri, 07 Sep 2001 03:00:00 GMT  
 Doubt: DLLs and calling conventions
The name of your ReadFile function is C++ mangled. All your exported
functions should have

    extern "C" {...}

modifier. For example:

extern "C" {
                __declspec(dllexport) void __stdcall ReadFile(const char *
pFileName,
                char * pData)
            }

Or you have to write an Extension DLL .

Hope this helps.


Quote:
>Hi all,

>I am trying to create a DLL intended to be used from a certain IDE. When I
>run the application, it complains it is not being able to find the function

>The function has been defined as __declspec(dllexport) void __stdcall
>ReadFile(const char * pFileName, char * pData). I've read the documentation
>for "__stdcall", and it says the naming convention is "_" + functionName +


>Any ideas?

>Thanks in advance,
>Best regards,

>Augusto Jun Devegili



Fri, 07 Sep 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Calling an exported function of a dll which are exported Stdcall calling convention

2. Bad DLL calling convention in my MFC (for VB) DLL

3. VC6 DLL calls VB6 DLL calls back to VC6 DLL: Occasional GPF or ‘Bad DLL calling convention'

4. Calling Conventions using C++ and Fortran Dlls

5. Bad DLL calling convention?

6. VC++ dll calling conventions

7. Bad dll calling convention

8. bad dll calling convention, on conversion from 16bit to 32 bit

9. Bad DLL calling convention?

10. C++ 4 and 5 no good for building DLLs which have functions using pascal calling convention

11. DLL calling conventions

12. DLL Calling Convention

 

 
Powered by phpBB® Forum Software