Click here to Skip to main content
15,910,009 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: about "break" Pin
Tomasz Sowinski12-Nov-01 3:10
Tomasz Sowinski12-Nov-01 3:10 
GeneralRe: about "break" Pin
Christian Graus12-Nov-01 17:25
protectorChristian Graus12-Nov-01 17:25 
QuestionHow to Change text color in a bitmap image? Pin
chen11-Nov-01 23:04
chen11-Nov-01 23:04 
AnswerRe: How to Change text color in a bitmap image? Pin
Christian Graus12-Nov-01 10:25
protectorChristian Graus12-Nov-01 10:25 
General[VC++]Create Excel sheet Pin
11-Nov-01 21:47
suss11-Nov-01 21:47 
GeneralRe: [VC++]Create Excel sheet Pin
Tomasz Sowinski12-Nov-01 1:07
Tomasz Sowinski12-Nov-01 1:07 
GeneralRe: [VC++]Create Excel sheet Pin
Richard Ellis12-Nov-01 12:48
Richard Ellis12-Nov-01 12:48 
GeneralDll Pin
Deian11-Nov-01 21:33
Deian11-Nov-01 21:33 
Hello guru's and here I go again:

I'm writing a dll that holds some of the data for my main program to work with. I have 3 functions in the dll which I want to access using GetProcAddress. Everything works perfect if I use the lib file for the dll and it's header in the main program - I call the functions and the and the work great. But if I call LoadLibrary, then GetProcAddress I get thousands of exceptions and my program crashes.

Here is how my functions are defined:

(1) Body

__declspec(dllexport) CString GetPriceString(int nNum)
{
...do stuff
}
__declspec(dllexport) int GetStringCount()
{
...do stuff
}

(2)Header

__declspec(dllimport) int GetStringCount();
__declspec(dllimport) CString GetPriceString(int nNum);

If I use the lib and header file for the above func. everything works fine, but if I don't and I really want to call the functions with GetProcAddress, it doesen't.

(3) DEF file

GetPriceSting
GetStringCount

(4) The way I use the GetProcAddress

CString (*GetPriceString)(int); // global
int (*GetStringCount)(void); // another global

(5) In the function

HINSTANCE hDll=::LoadLybrary("TheDll.dll");
GetPriceString=(GetPriceString)::GetProcAddress(hDll, "GetPriceString");

// Exception
GetPriceString(nNum);

So, if anyone can guide me of what I'm doing wrong - may be in the way that I construct the dll, or the way i call the functions, I'll be very thankful. Code sample appreciated also.

Greetings,

Deian
Confused | :confused: Mad | :mad: Cry | :(( Eek! | :eek: Dead | X|
GeneralRe: Dll Pin
Michael Dunn11-Nov-01 21:37
sitebuilderMichael Dunn11-Nov-01 21:37 
Generalpath of the users favorites dir Pin
11-Nov-01 21:25
suss11-Nov-01 21:25 
GeneralRe: path of the users favorites dir Pin
Michael Dunn11-Nov-01 21:48
sitebuilderMichael Dunn11-Nov-01 21:48 
Questionhow to allot a big memory? Pin
cococut11-Nov-01 21:09
cococut11-Nov-01 21:09 
AnswerRe: how to allot a big memory? Pin
Tomasz Sowinski12-Nov-01 0:40
Tomasz Sowinski12-Nov-01 0:40 
GeneralUsing comctl v6 manifest on XP Pin
Michael Dunn11-Nov-01 18:19
sitebuilderMichael Dunn11-Nov-01 18:19 
GeneralRe: Using comctl v6 manifest on XP Pin
Matt Newman12-Nov-01 11:11
Matt Newman12-Nov-01 11:11 
GeneralRe: Using comctl v6 manifest on XP Pin
Michael Dunn12-Nov-01 16:07
sitebuilderMichael Dunn12-Nov-01 16:07 
GeneralRe: Using comctl v6 manifest on XP Pin
Michael Dunn14-Nov-01 12:38
sitebuilderMichael Dunn14-Nov-01 12:38 
GeneralRe: Using comctl v6 manifest on XP Pin
Matt Newman15-Nov-01 14:03
Matt Newman15-Nov-01 14:03 
GeneralRe: Using comctl v6 manifest on XP Pin
Michael Dunn15-Nov-01 14:27
sitebuilderMichael Dunn15-Nov-01 14:27 
GeneralRe: Using comctl v6 manifest on XP Pin
Matt Newman16-Nov-01 16:08
Matt Newman16-Nov-01 16:08 
GeneralRe: Using comctl v6 manifest on XP Pin
Michael Dunn16-Nov-01 16:34
sitebuilderMichael Dunn16-Nov-01 16:34 
GeneralRe: Using comctl v6 manifest on XP Pin
Matt Newman16-Nov-01 16:44
Matt Newman16-Nov-01 16:44 
Generala few questions Pin
11-Nov-01 17:14
suss11-Nov-01 17:14 
GeneralRe: a few questions Pin
Christian Graus11-Nov-01 17:27
protectorChristian Graus11-Nov-01 17:27 
GeneralRe: a few questions Pin
11-Nov-01 18:12
suss11-Nov-01 18:12 

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.