Calling function in another dll.

J

jis

Hi C++ gurus

I have a problem.

I am trying to call a function which is in another dll. but i have
problems when i run in release mode.it works good in debug mode, iam
using vc++ .

this is what iam doing

typedef void (CALLBACK *atc_crypt)(double Nbr);

atc_crypt crypt;

HINSTANCE hDLL = LoadLibrary("D:\\Programs\\crypt.dll");

crypt = GetProcAddress(HMODULE(hDLL ), "atc_crypt");

crypt(Nbr);


i get exception while running in release mode.

please help.

thnks
jis
 
V

Victor Bazarov

jis said:
Hi C++ gurus

I have a problem.

But it's not a _C++_ problem. Just so you know...
I am trying to call a function which is in another dll. but i have
problems when i run in release mode.it works good in debug mode, iam
using vc++ .

Consider asking in 'microsoft.public.vc.language', then. At least DLLs
are more on topic there.
this is what iam doing

typedef void (CALLBACK *atc_crypt)(double Nbr);

'CALLBACK' is some kind of macro, isn't it? Most likely OS- or
compiler-specific. In that case you need to post to the newsgroup
dedicated to your OS or your compiler.
atc_crypt crypt;

HINSTANCE hDLL = LoadLibrary("D:\\Programs\\crypt.dll");

You don't check the value of 'hDLL' for validity. Why? Are you sure
it's valid?
crypt = GetProcAddress(HMODULE(hDLL ), "atc_crypt");

You don't check the value of 'crypt' for validity. Why?
crypt(Nbr);

What is the type of 'Nbr'?
i get exception while running in release mode.

What kind of exception? Try the FAQ, section 5, questions 5.8 and 5.9,
see if they help.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top