473,324 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

accessing a function from DLL

AS
Hi ,

I have exported the following function from a dll ,

extern "C" DECL_MYEXPORTS LRESULT CALLBACK MouseProc(int nCode,WPARAM
wParam,LPARAM lParam);

//in my calling code , I tried to access the function as below:

static HINSTANCE hinstDLL;

typedef LRESULT (CALLBACK *MOUSEPROC)(int nCode,WPARAM wParam,LPARAM
lParam); // typedef a function pointer to access the function

hinstDLL = LoadLibrary(_T("F:\\inter\\MyFirstDll\\debug\\MyFi rstDll.dll"));
//hInstDLL is valid

MOUSEPROC hproc = (MOUSEPROC)GetProcAddress(hinstDLL,"MouseProc"); // hProc
is still NULL

Question: I'm not able to access the function thru GetProcAddress. Is the
typedef "typedef LRESULT (CALLBACK *MOUSEPROC)(int nCode,WPARAM
wParam,LPARAM lParam); " is corect or what is goin wrong here ?

Thanks

Sudhakar
Mar 7 '08 #1
2 1746
Tom
On 7 Mrz., 11:54, "AS" <A...@mic.comwrote:
MOUSEPROC hproc = (MOUSEPROC)GetProcAddress(hinstDLL,"MouseProc"); *//hProc
is still NULL
Sudhakar

try the "Depency Walker" to check the DLL and see if the function is
exported under the right name. Sometimes the names are "decorated" by
the linker.

Thomas
------------------
Synchronize your Outlook: http://www.easy2sync.com/de/produkte/e2s4o.php

Mar 7 '08 #2
AS
The function name is decorated, if I use the CALLBACK in the function
declaration ,

BUt tell me , how to get rid of this. THe function must have the prototype
" LRESULT CALLBACK MouseProc(int nCode,WPARAM wParam,LPARAM lParam);" in
the dll and it is exported with extern "C" But still it is decorated like
_MouseProc@12. Then, How can we use the exported function thru
GetProcAddress in the client application
with
"Tom" <ne***********@itsth.dewrote in message
news:14**********************************@m36g2000 hse.googlegroups.com...
On 7 Mrz., 11:54, "AS" <A...@mic.comwrote:
MOUSEPROC hproc = (MOUSEPROC)GetProcAddress(hinstDLL,"MouseProc"); //
hProc
is still NULL
Sudhakar

try the "Depency Walker" to check the DLL and see if the function is
exported under the right name. Sometimes the names are "decorated" by
the linker.

Thomas
------------------
Synchronize your Outlook: http://www.easy2sync.com/de/produkte/e2s4o.php
Mar 10 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steven T. Hatton | last post by:
I find the surprising. If I derive Rectangle from Point, I can access the members of Point inherited by Rectangle _IF_ they are actually members of a Rectangle. If I have a member of type Point...
6
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is...
5
by: Mike Oliszewski | last post by:
Given the following c# code: namespace Company2 { public class SomeFunctions { public void FunctionA() { // Do Something. }
0
by: N. Demos | last post by:
Hello, I'm having problems accessing a complex XML child node (latitude & longitude), and passing it to a function when the XML file has been read into a DataSet. Specifically, the returned object...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
3
by: Frederick Gotham | last post by:
Back in the day, if you wanted a function to be self-contained within a translation unit, you defined the function as "static". If there were an external linkage function by the same name...
2
by: Vincent | last post by:
I have been trying to find some API routines that will allow me to determine the name of the computer that is accessing a file on a server. I have found the NetFileEnum call (returns the names of...
0
by: aakash | last post by:
Hello Guys I am upsizing ms access project to give it a ms sql connectivity I am having problem in accessing form control values in ms sql function CREATE FUNCTION "ReportList DateRange"() ...
3
by: judy.j.miller | last post by:
Does anyone know why i can't access a form element value using dot notation in firefox, when i'm in a function. Works ok in the body. I'm trying to do this: var FarTemp = faren.temp.value; I...
3
by: Nathan Sokalski | last post by:
I have a validator that I wrote by inheriting from BaseValidator. At certain points in the code, I need to access other controls on the page containing the validator. I have the IDs of these...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.