Click here to Skip to main content
15,921,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: com dll problem Pin
rjkg3-Jul-08 2:38
rjkg3-Jul-08 2:38 
AnswerRe: com dll problem Pin
Roger Stoltz3-Jul-08 2:39
Roger Stoltz3-Jul-08 2:39 
GeneralRe: com dll problem Pin
KarstenK3-Jul-08 3:10
mveKarstenK3-Jul-08 3:10 
AnswerRe: com dll problem Pin
KarstenK3-Jul-08 3:09
mveKarstenK3-Jul-08 3:09 
QuestionAvoiding global in Callbacks Pin
flip3-Jul-08 2:01
flip3-Jul-08 2:01 
QuestionConvert Visual Studio 2005 ATL project into Visual C++ 6.0 project Pin
dolly3-Jul-08 1:52
dolly3-Jul-08 1:52 
AnswerRe: Convert Visual Studio 2005 ATL project into Visual C++ 6.0 project Pin
Gary R. Wheeler3-Jul-08 1:55
Gary R. Wheeler3-Jul-08 1:55 
QuestionWrapping a C++ LIB into a DLL Pin
indogerman3-Jul-08 1:50
indogerman3-Jul-08 1:50 
Hi Guys,

I am trying to wrap a LIB file (content unknown, but header file is available) into a DLL, so as to be able to use it in a C# App.

I have created a C++ DLL (MFC-Shared) with the following code:
/********************* Header File **********************/

#pragma once

#ifndef __AFXWIN_H__	#error "include 'stdafx.h' before including this file for PCH"
#endif
#ifndef _DEFINED_myProg_H_  
#define _DEFINED_myProg_H_  
                                                                 
  #if _MSC_VER > 1000  
    #pragma once                                           
  #endif 
                                                                 
  #ifdef __cplusplus  
  extern "C" {                                     
  #endif 
                                                                 
  #ifdef __cplusplus    
  }                                                 
  #endif 
#endif 
#include "resource.h"		// main symbols
#include "origlib.h"		//Original Lib File


//Declaration of the function (without using classes)
bool GetList(CString *List1, CString *List2, CString *List3, int &iCount);


/******************************************************/


/********************* DLL - CPP File ***********************/


#include "stdafx.h"
#include "origlib.h"		//Original Lib File
#include "myprog.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

extern "C" __declspec(dllexport) bool GetList(CString *List1, CString *List2, CString *List3, int &iCount);

bool GetList(CString *List1, CString *List2, CString *List3, int &iCount);
{
		// Do work. Fill the lists with data, which has to given back from the function.
    return bVal;
}

/****************************************************************/




This DLL compiles ok.
So, i tried to test it in a MFC Test Application:

/********************* Testing - CPP File ***********************/

void CDLLTestDlg::OnBnClickedSearchbutton()
{
    CString *Arr1, *Arr2, *Arr3;
    int iDev = 0;
    GetList(Arr1, Arr2, Arr3, iDev);
}


However, here I get a linker error:
LNK2001: unresolved external symbol "bool __cdecl GetList (class ATL::CStringT<wchar_t,> blah...blah...,int &)" (?GetList@@YA_NPAV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@00AAH@Z)


Could anyone please help me, where I am going wrong??

Thank u soooo much Smile | :)
AnswerRe: Wrapping a C++ LIB into a DLL Pin
Gary R. Wheeler3-Jul-08 1:58
Gary R. Wheeler3-Jul-08 1:58 
AnswerRe: Wrapping a C++ LIB into a DLL Pin
KarstenK3-Jul-08 3:14
mveKarstenK3-Jul-08 3:14 
QuestionBorderLess AboutBox. Pin
Le@rner3-Jul-08 1:36
Le@rner3-Jul-08 1:36 
AnswerRe: BorderLess AboutBox. Pin
CPallini3-Jul-08 1:41
mveCPallini3-Jul-08 1:41 
AnswerRe: BorderLess AboutBox. Pin
Rajesh R Subramanian3-Jul-08 1:42
professionalRajesh R Subramanian3-Jul-08 1:42 
GeneralRe: BorderLess AboutBox. Pin
CPallini3-Jul-08 2:08
mveCPallini3-Jul-08 2:08 
GeneralRe: BorderLess AboutBox. Pin
Rajesh R Subramanian3-Jul-08 2:25
professionalRajesh R Subramanian3-Jul-08 2:25 
GeneralOT Pin
CPallini3-Jul-08 22:24
mveCPallini3-Jul-08 22:24 
GeneralRe: OT Pin
Rajesh R Subramanian3-Jul-08 22:32
professionalRajesh R Subramanian3-Jul-08 22:32 
GeneralRe: OT Pin
CPallini3-Jul-08 23:30
mveCPallini3-Jul-08 23:30 
GeneralRe: BorderLess AboutBox. Pin
Le@rner3-Jul-08 2:43
Le@rner3-Jul-08 2:43 
Questioncannot move temporary file. [modified] Pin
manju#1233-Jul-08 1:22
manju#1233-Jul-08 1:22 
AnswerRe: cannot move temporary file. Pin
Iain Clarke, Warrior Programmer3-Jul-08 2:02
Iain Clarke, Warrior Programmer3-Jul-08 2:02 
AnswerRe: cannot move temporary file. Pin
Jijo.Raj3-Jul-08 9:49
Jijo.Raj3-Jul-08 9:49 
QuestionMaking CEdit Transparent Pin
sudhir_Kumar3-Jul-08 1:22
sudhir_Kumar3-Jul-08 1:22 
AnswerRe: Making CEdit Transparent Pin
Iain Clarke, Warrior Programmer3-Jul-08 2:05
Iain Clarke, Warrior Programmer3-Jul-08 2:05 
AnswerRe: Making CEdit Transparent Pin
Paresh Chitte3-Jul-08 2:27
Paresh Chitte3-Jul-08 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.