Click here to Skip to main content
15,900,589 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am trying to write a dll file which can be used in another application using loadlibrary api.

In my dll file in .h file I wrote the following code

XML
#include <tchar.h>
#if defined DLL_EXPORT
#define DECLDIR __declspec(dllexport)
#else
#define DECLDIR __declspec(dllimport)
#endif

    DECLDIR void ExecuteExternalFile(int count, ...)


and in my cpp file
XML
#include "stdafx.h"
#include <iostream>
#include "puttycmddll.h"
#include <windows.h>
#define DLL_EXPORT
//#define DECLDIR __declspec(dllexport)
   void ExecuteExternalFile(int count, ...)
   {bla blah...}


and in my .def file
LIBRARY "commandlineputtydll"
EXPORTS
ExecuteExternalFile @1

But while compiling I am getting warning inconsistent dll linkage" warning C4273: 'ExecuteExternalFile' : inconsistent dll linkage"

and I am not able to load the library also please help me
Thanks in advance....
Praveen
Posted
Updated 2-Nov-10 22:36pm
v2
Comments
Dalek Dave 3-Nov-10 4:36am    
Edited for Grammar.

Try this
class __declspec(dllexport) CTestDlg : public CDialog
 
Share this answer
 
HI,
thanks for the support
soory actually my dll part was working fine i was not able to understand that th real problem was where i tried to load the dll file i was trying like hDLL = LoadLibrary((LPCSTR)"commandlineputtydll.dll");
actually it should be hDLL = LoadLibrary(TEXT("commandlineputtydll.dll"));
for its proper working..
 
Share this answer
 
Comments
GAJERA 3-Nov-10 5:03am    
ok

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900