does mql work with UNMANAGED dlls from vc++2005?

 

dear all

I have created a very very simple dll using visual studio 2005; here is the definitions, but it doesn't work:

cpp file:

// TestDLL.cpp : Defines the entry point for the DLL application.

//

#include "stdafx.h"

#ifdef _MANAGED

#pragma managed(push, off)

#endif

//-----------------------------------------------------------------------------------------

//-----------------------------------------------------------------------------------------

//-----------------------------------------------------------------------------------------

__declspec ( dllexport ) int __stdcall Test()

{

return (5);

}

__declspec ( dllexport ) char * __stdcall TestChar()

{

return ( "Hello" );

}

stdafx.h:

// stdafx.h : include file for standard system include files,

// or project specific include files that are used frequently, but

// are changed infrequently

//

#pragma once

// Modify the following defines if you have to target a platform prior to the ones specified below.

// Refer to MSDN for the latest info on corresponding values for different platforms.

#ifndef WINVER // Allow use of features specific to Windows XP or later.

#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.

#endif

#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.

#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.

#endif

#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.

#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.

#endif

#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.

#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.

#endif

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers

// Windows Header Files:

#include <windows.h>


#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit

#include <atlbase.h>

#include <atlstr.h>

// TODO: reference additional headers your program requires here


and def file:

LIBRARY "TestDLL"

exports

test


but it doesn't work.

what can I do?

 

LIBRARY "TestDLL"

Quotes not required...

LIBRARY TestDLL

 
phy:

LIBRARY "TestDLL"

Quotes not required...

LIBRARY TestDLL




thanks, but it still doesn't work (Error 127)
 

Have you modified the project properties to "include" the DEF file?

Have you gotten the sample DLL to work?

The exported call "test" does not match the call in the code "Test"

exports is not capitalized EXPORTS (if it matters)

... and yes, it will work with VisualStudio 2005
 
phy:

Have you modified the project properties to "include" the DEF file?

Have you gotten the sample DLL to work?

The exported call "test" does not match the call in the code "Test"

exports is not capitalized EXPORTS (if it matters)

... and yes, it will work with VisualStudio 2005


Thanks phy

I'm a beginer; could you please give me more details?

how can I modify project properties to include def file?

and now, after capitalizing EXPORTS and Test, i'm receiving LNK4017 error:

1>TestDLL.def(2) : warning LNK4017: Exports statement not supported for the target platform; ignored

1>TestDLL.def(2) : warning LNK4017: Test statement not supported for the target platform; ignored


and when we use __declspec ( dllexport ), shall we use def file also?

could you please help?

 

Have you built the sample DLL included with MT4 ?


Open ( and allow to convert) the project in C:\Program Files\MetaTrader\experts\samples\DLLSample


Adding DEF file:

Reason: