PC Review


Reply
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average.

How can call a DLL function using GetProcAddress

 
 
=?Utf-8?B?TWF1cmljaW8=?=
Guest
Posts: n/a
 
      18th May 2005
I am developing a project where I made one DLL in Embedded C++ 4.0 with
determined functions that will be executed in one applicatory developed in C
# with SmartPhone 2003.


The order of the customer, I must carry through one LoadLibrary to load some
initial configurations. To have access these methods, I must use the
GetProcAddress to recoup the Handle of the methods. Until this point I obtain
all the necessary information but as I must execute the method that he is in
my DLL. It stows seeing the documentation of Microsoft and vi that I must use
the MethodInfo classroom to execute such method but I am not obtaining
results. Somebody would have some example.

Thanks for help
 
Reply With Quote
 
 
 
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      18th May 2005
Function pointers are not supported in the CF, so there's really no way to
do what I think you're trying to do. If you can't declare it with a
P/Invoke, you can't call it.

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate


"Mauricio" <(E-Mail Removed)> wrote in message
news:162285CC-D652-4726-ACCD-(E-Mail Removed)...
>I am developing a project where I made one DLL in Embedded C++ 4.0 with
> determined functions that will be executed in one applicatory developed in
> C
> # with SmartPhone 2003.
>
>
> The order of the customer, I must carry through one LoadLibrary to load
> some
> initial configurations. To have access these methods, I must use the
> GetProcAddress to recoup the Handle of the methods. Until this point I
> obtain
> all the necessary information but as I must execute the method that he is
> in
> my DLL. It stows seeing the documentation of Microsoft and vi that I must
> use
> the MethodInfo classroom to execute such method but I am not obtaining
> results. Somebody would have some example.
>
> Thanks for help



 
Reply With Quote
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      18th May 2005
You could create a shim DLL, also with eVC, and call *that* from your
managed code. The shim would load the library, get the address and call the
function, maybe returning an error, if the library couldn't be loaded or
whatever.

Paul T.

"Chris Tacke, eMVP" <(E-Mail Removed)> wrote in message
news:u1cLP$(E-Mail Removed)...
> Function pointers are not supported in the CF, so there's really no way to
> do what I think you're trying to do. If you can't declare it with a
> P/Invoke, you can't call it.
>
> --
> Chris Tacke
> Co-founder
> OpenNETCF.org
> Has OpenNETCF helped you? Consider donating to support us!
> http://www.opennetcf.org/donate
>
>
> "Mauricio" <(E-Mail Removed)> wrote in message
> news:162285CC-D652-4726-ACCD-(E-Mail Removed)...
>>I am developing a project where I made one DLL in Embedded C++ 4.0 with
>> determined functions that will be executed in one applicatory developed
>> in C
>> # with SmartPhone 2003.
>>
>>
>> The order of the customer, I must carry through one LoadLibrary to load
>> some
>> initial configurations. To have access these methods, I must use the
>> GetProcAddress to recoup the Handle of the methods. Until this point I
>> obtain
>> all the necessary information but as I must execute the method that he is
>> in
>> my DLL. It stows seeing the documentation of Microsoft and vi that I must
>> use
>> the MethodInfo classroom to execute such method but I am not obtaining
>> results. Somebody would have some example.
>>
>> Thanks for help

>
>



 
Reply With Quote
 
=?Utf-8?B?TWF1cmljaW8=?=
Guest
Posts: n/a
 
      19th May 2005
I found this method

MethodBase.GetMethodFromHandle().Invoke

But, this method, GetMethodFromHandle(), need a parameter of type
RuntimeMethodHandle Structure

How I use this Method?

I think that I can use this method for calling my DLL method. This is
possible or not??? If the ask is true, how can I use this method. Anybody had
a example for this method????

Thank so much for help

Mauricio

"Paul G. Tobey [eMVP]" wrote:

> You could create a shim DLL, also with eVC, and call *that* from your
> managed code. The shim would load the library, get the address and call the
> function, maybe returning an error, if the library couldn't be loaded or
> whatever.
>
> Paul T.
>
> "Chris Tacke, eMVP" <(E-Mail Removed)> wrote in message
> news:u1cLP$(E-Mail Removed)...
> > Function pointers are not supported in the CF, so there's really no way to
> > do what I think you're trying to do. If you can't declare it with a
> > P/Invoke, you can't call it.
> >
> > --
> > Chris Tacke
> > Co-founder
> > OpenNETCF.org
> > Has OpenNETCF helped you? Consider donating to support us!
> > http://www.opennetcf.org/donate
> >
> >
> > "Mauricio" <(E-Mail Removed)> wrote in message
> > news:162285CC-D652-4726-ACCD-(E-Mail Removed)...
> >>I am developing a project where I made one DLL in Embedded C++ 4.0 with
> >> determined functions that will be executed in one applicatory developed
> >> in C
> >> # with SmartPhone 2003.
> >>
> >>
> >> The order of the customer, I must carry through one LoadLibrary to load
> >> some
> >> initial configurations. To have access these methods, I must use the
> >> GetProcAddress to recoup the Handle of the methods. Until this point I
> >> obtain
> >> all the necessary information but as I must execute the method that he is
> >> in
> >> my DLL. It stows seeing the documentation of Microsoft and vi that I must
> >> use
> >> the MethodInfo classroom to execute such method but I am not obtaining
> >> results. Somebody would have some example.
> >>
> >> Thanks for help

> >
> >

>
>
>

 
Reply With Quote
 
Guest
Posts: n/a
 
      19th May 2005
I thought we already established that you can't do this. You cannot call a
function pointer. The only workaround is to write an unmanaged shim as Paul
suggested.

-Chris


"Mauricio" <(E-Mail Removed)> wrote in message
news:5EBB70C5-FDB5-4507-B38F-(E-Mail Removed)...
>I found this method
>
> MethodBase.GetMethodFromHandle().Invoke
>
> But, this method, GetMethodFromHandle(), need a parameter of type
> RuntimeMethodHandle Structure
>
> How I use this Method?
>
> I think that I can use this method for calling my DLL method. This is
> possible or not??? If the ask is true, how can I use this method. Anybody
> had
> a example for this method????
>
> Thank so much for help
>
> Mauricio
>
> "Paul G. Tobey [eMVP]" wrote:
>
>> You could create a shim DLL, also with eVC, and call *that* from your
>> managed code. The shim would load the library, get the address and call
>> the
>> function, maybe returning an error, if the library couldn't be loaded or
>> whatever.
>>
>> Paul T.
>>
>> "Chris Tacke, eMVP" <(E-Mail Removed)> wrote in message
>> news:u1cLP$(E-Mail Removed)...
>> > Function pointers are not supported in the CF, so there's really no way
>> > to
>> > do what I think you're trying to do. If you can't declare it with a
>> > P/Invoke, you can't call it.
>> >
>> > --
>> > Chris Tacke
>> > Co-founder
>> > OpenNETCF.org
>> > Has OpenNETCF helped you? Consider donating to support us!
>> > http://www.opennetcf.org/donate
>> >
>> >
>> > "Mauricio" <(E-Mail Removed)> wrote in message
>> > news:162285CC-D652-4726-ACCD-(E-Mail Removed)...
>> >>I am developing a project where I made one DLL in Embedded C++ 4.0 with
>> >> determined functions that will be executed in one applicatory
>> >> developed
>> >> in C
>> >> # with SmartPhone 2003.
>> >>
>> >>
>> >> The order of the customer, I must carry through one LoadLibrary to
>> >> load
>> >> some
>> >> initial configurations. To have access these methods, I must use the
>> >> GetProcAddress to recoup the Handle of the methods. Until this point I
>> >> obtain
>> >> all the necessary information but as I must execute the method that he
>> >> is
>> >> in
>> >> my DLL. It stows seeing the documentation of Microsoft and vi that I
>> >> must
>> >> use
>> >> the MethodInfo classroom to execute such method but I am not obtaining
>> >> results. Somebody would have some example.
>> >>
>> >> Thanks for help
>> >
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call javascript function without using any event call cschang Microsoft ADO .NET 3 1st Feb 2005 03:04 AM
Executing the address from GetProcAddress Troy Anderson Microsoft Dot NET Compact Framework 6 4th Jan 2005 04:37 AM
How to Call LoadLibrary/GetProcAddress? Siegfried Heintze Microsoft C# .NET 3 25th Jun 2004 08:04 PM
get function name for the GetProcAddress function DMamoun Microsoft C# .NET 1 27th May 2004 03:49 PM
Why does a call to a function in a dll take less time if you call it repeatedly? Justin Galzic Microsoft Dot NET Framework 5 23rd Feb 2004 06:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:25 PM.