On Wed, Jan 21, 2009 at 12:43 PM, Mario Chacon <the.masch@gmail.com> wrote:
Thank for update the wiki!..

On Wed, Jan 21, 2009 at 11:34 AM, Xavier Miller <xavier.miller@cauwe.org> wrote:
You also need to add

       extern "C"
Maybe do I need to include __declspec, right ?
 



Mario Chacon a écrit :
> Thank you so much for your fast answer, here it's my declaration:
>
> #ifndef DLL3_H
> #define DLL3_H
>
> #ifdef DLL3_EXPORTS
>     #define DLL3_API __declspec(dllexport)
> #else
>     #define DLL3_API __declspec(dllimport)
> #endif
>
>
> ///////////////////////////////////////////////////////////////////////////////
> // This class is exported from DLL3.dll
> class DLL3_API CDLL3
> {
> public:
>     CDLL3();
>     int GetCpuSpeed();
> };
>
> void * __stdcall CreateDll3();
> void __stdcall DestroyDll3(void * objptr);
> int __stdcall GetCpuSpeedDll3(void * objptr);
>
> #endif //DLL3_H
>
> // DLL3.cpp : Defines the entry point for the DLL application.
> //
>
> //#include "stdafx.h"
> #define DLL3_EXPORTS
> #include "dll.h"
> #include <windows.h>
>
> BOOL APIENTRY DllMain( HANDLE /*hModule*/,
>                        DWORD  ul_reason_for_call,
>                        LPVOID /*lpReserved*/
>                      )
> {
>     switch (ul_reason_for_call)
>     {
>         case DLL_PROCESS_ATTACH:
>         case DLL_THREAD_ATTACH:
>         case DLL_THREAD_DETACH:
>         case DLL_PROCESS_DETACH:
>             break;
>     }
>     return TRUE;
> }
> CDLL3::CDLL3()
> {
> }
>
> int CDLL3::GetCpuSpeed()
> {
> //    const unsigned __int64 ui64StartCycle = GetCycleCount();
> //    Sleep(1000);
>     return 1;;//static_cast<int>((GetCycleCount() - ui64StartCycle) /
> 1000000);
> }
> ///////////////////////////////////////////////////////////////////////////////
> // Class wrapper functions
> ///////////////////////////////////////////////////////////////////////////////
>
> ///////////////////////////////////////////////////////////////////////////////
> // CreateDLL3 - create an instance of the class CDLL3
> void * __stdcall CreateDll3()
> {
>     return new CDLL3;
> }
>
> ///////////////////////////////////////////////////////////////////////////////
> // DestroyDLL3 - free the memory for the class instance
> void __stdcall DestroyDll3(void * objptr)
> {
>     CDLL3 *dll3 = (CDLL3 *) objptr;
>     if (dll3)
>         delete dll3;
> }
>
> ///////////////////////////////////////////////////////////////////////////////
> // GetCpuSpeed - returns CPU speed in MHz;  for example, ~2193 will be
> //               returned for a 2.2 GHz CPU.
> int __stdcall GetCpuSpeedDll3(void * objptr)
> {
>     CDLL3 *dll3 = (CDLL3 *) objptr;
>     if (dll3)
>         return dll3->GetCpuSpeed();
>     else
>         return 0;
> }
>
> I will check the pages you give me to me, one again THANK YOU!..
>
> Salu2...
>
>
> On Wed, Jan 21, 2009 at 11:12 AM, Greg Chicares <gchicares@sbcglobal.net
> <mailto:gchicares@sbcglobal.net>> wrote:
>
>     On 2009-01-21 12:44Z, Mario Chacon wrote:
>      > I'm using devc++ to compile a C++ class and I need to use it from
>     a "VB6
>      > application", :(. I'm exporting the function as C with stdcall
>     but the
>      > result name it have "bad name", for example a function called
>      > GetCpuSpeedDll3 in C++ in VB6 it's named _ZN5CDLL311GetCpuSpeedEv.
>
>     That name...
>      $c++filt __ZN5CDLL311GetCpuSpeedEv
>      CDLL3::GetCpuSpeed()
>     ...seems to suggest that this function is defined inside a
>     C++ class or a C++ namespace, and is not named 'GetCpuSpeedDll3'.
>     Maybe you should copy and paste the function declaration here.
>
>      > I found this tutorial but it's empty:
>      > http://www.mingw.org/wiki/Visual_Basic_DLL
>
>     This search:
>      http://www.google.com/search?q="visual+basic"+dll+mingw
>     leads to these pages (among others) that might be helpful:
>      http://osetools.progw.org/index.php/VB-MinGW-DLL
>      http://wyw.dcweb.cn/stdcall.htm
>
>     ------------------------------------------------------------------------------
>     This SF.net email is sponsored by:
>     SourcForge Community
>     SourceForge wants to tell your story.
>     http://p.sf.net/sfu/sf-spreadtheword
>     _______________________________________________
>     MinGW-users mailing list
>     MinGW-users@lists.sourceforge.net
>     <mailto:MinGW-users@lists.sourceforge.net>
>
>     You may change your MinGW Account Options or unsubscribe at:
>     https://lists.sourceforge.net/lists/listinfo/mingw-users
>
>     _______________________________________________
>     This list observes the Etiquette found at
>     http://www.mingw.org/Mailing_Lists.
>     We ask that you be polite and do the same.
>
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> MinGW-users mailing list
> MinGW-users@lists.sourceforge.net
>
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
>
> _______________________________________________
> This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Thank you for all men...! It work great!!