Dear All,
I am trying to create a DLL file for some testing works related to my field. I am using Dev-C++ 4.9.9.2 for doing this. This DLL will be used by a VECTOR Software(CAN DIVA). I am using a template given by Vector.But when I compile it I keep getting the error message "Function Definition is marked DLL Import. "
As I am a newbie can any please help me out.
I have pasted the .cpp & .h file below.
Code:
//****************************************************************************************
// File name: KeyGenAlgo.h
// Description: Abstract base class defines the interface for the key generation algorithm
// Date: 2003-07-17
// Copyright: Vector Informatik GmbH - 2003
//****************************************************************************************
#ifndef KEY_GEN_ALGO_INTERFACE_H
#define KEY_GEN_ALGO_INTERFACE_H
#if _MSC_VER > 1000
#pragma once
#endif
#ifdef KEYGENALGO_EXPORTS
#define KEYGENALGO_API extern "C" __declspec(dllexport)
#else
#define KEYGENALGO_API __declspec(dllimport)
#endif
enum VKeyGenResultEx
{
KGRE_Ok = 0,
KGRE_BufferToSmall = 1,
KGRE_SecurityLevelInvalid = 2,
KGRE_VariantInvalid = 3,
KGRE_UnspecifiedError = 4
};
// The client has to provide a keyArray buffer and has to transfer this buffer -
// including its size - to the GenerateKey method. The method checks, if the size is
// sufficient. The client can discover the required size by examinig the service used
// transfer the key to the ECU.
// Returns false if the key could not be generated:
// -> keyArraySize to small
// -> generation for specified security level not possible
// -> variant unknown
KEYGENALGO_API VKeyGenResultEx GenerateKeyEx(
const unsigned char* iSeedArray, unsigned short iSeedArraySize,
const unsigned int iSecurityLevel, const char* iVariant,
unsigned char* ioKeyArray, unsigned int iKeyArraySize, unsigned int& oSize);
#endif // KEY_GEN_ALGO_INTERFACE_H
//*********************************************************************************************
//*********************************************************************************************
// KeyGeneration.cpp : Defines the entry point for the DLL application.
#include <windows.h>
#include "KeyGenAlgoInterfaceEx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
KEYGENALGO_API VKeyGenResultEx GenerateKeyEx(
const unsigned char* iSeedArray, unsigned short iSeedArraySize,
const unsigned int iSecurityLevel, const char* iVariant,
unsigned char* ioKeyArray, unsigned int iKeyArraySize, unsigned int& oSize)
//the constant key 0x22 0x32 is returned by this example
{
ioKeyArray[0] = 0x22;
ioKeyArray[1] = 0x32;
oSize = iSeedArraySize;
return KGRE_Ok;
}
This is the error message that I get
22 C:\Documents and Settings\Administrator\Desktop\Dev C\DLL\1\KeyGeneration.cpp function `VKeyGenResultEx GenerateKeyEx(const unsigned char*, short unsigned int, unsigned int, const char*, unsigned char*, unsigned int, unsigned int&)' definition is marked dllimport.
Thanks