By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,686 Members | 2,756 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,686 IT Pros & Developers. It's quick & easy.

How to obtain assembly name in unmanaged call?

P: n/a
Hi Expert,

Is there a way to obtain assembly name in an unmanaged call? During Interop
call between managed to unmanaged, I would like to know in unmanaged code
about the caller of assembly file name?

Thanks,
GP.
Jul 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hello GP,
Perhaps you may get the assebmly name on the managed side, then pass it by
one public method to the unmanaged side.

"Gnanaprakash Rathinam" <gn*******************@oracle.com> 写入消息新闻
:8X************@news.oracle.com...
Hi Expert,

Is there a way to obtain assembly name in an unmanaged call? During Interop call between managed to unmanaged, I would like to know in unmanaged code
about the caller of assembly file name?

Thanks,
GP.

Jul 21 '05 #2

P: n/a
Hi GP,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to get the name of an Assembly
in an unmanaged call. If there is any misunderstanding, please feel free to
let me know.

As far as I know, there isn't a direct way for us to get the Assembly name
in unmanaged code. However, we can get it easily in managed call. So we can
try to write a managed method which returns the name of the assembly and
interop with this assembly. You can use tlbexp.exe to export the type
library. Here is some more information.

http://msdn.microsoft.com/library/de...us/cptools/htm
l/cpgrfTypeLibraryExporterTlbExpexe.asp

We have to use a COM client to call the exported library. A win32 call
isn't suitable.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #3

P: n/a
Thanks for your reply,

But the problem here is different, due to some valid reason I can't modify
the signature of unmanaged call, In my appdomain there may be more than one
or more assemblies loaded and each may try to call unmanaged function
concurrently and based on the caller of the assembly I need to perform some
operation in my unmanaged function. I know that using managed & unmanaged
call stack trace I can retrieve the assembly name, but this is very lengthy
procedure. I looking for more easy way to do the same!!!

-GP
"Alan" <li***@channel.com> wrote in message
news:OJ**************@TK2MSFTNGP15.phx.gbl...
Hello GP,
Perhaps you may get the assebmly name on the managed side, then pass it by
one public method to the unmanaged side.

"Gnanaprakash Rathinam" <gn*******************@oracle.com> 写入消息新闻
:8X************@news.oracle.com...
Hi Expert,

Is there a way to obtain assembly name in an unmanaged call? During

Interop
call between managed to unmanaged, I would like to know in unmanaged code about the caller of assembly file name?

Thanks,
GP.


Jul 21 '05 #4

P: n/a
If you cannot add an argument to the method signature to identify the caller
then you are left with walking the stack to determine the caller. This is
expensive (i.e. non-performant) but if it is your only option, there you
are. You can cache the results so that further calls can be quickly looked
up.

Your best solution is to modify the unmanaged call signature.

"Gnanaprakash Rathinam" <gn*******************@oracle.com> wrote in message
news:_k*************@news.oracle.com...
Thanks for your reply,

But the problem here is different, due to some valid reason I can't modify
the signature of unmanaged call, In my appdomain there may be more than
one
or more assemblies loaded and each may try to call unmanaged function
concurrently and based on the caller of the assembly I need to perform
some
operation in my unmanaged function. I know that using managed & unmanaged
call stack trace I can retrieve the assembly name, but this is very
lengthy
procedure. I looking for more easy way to do the same!!!

-GP
"Alan" <li***@channel.com> wrote in message
news:OJ**************@TK2MSFTNGP15.phx.gbl...
Hello GP,
Perhaps you may get the assebmly name on the managed side, then pass it
by
one public method to the unmanaged side.

"Gnanaprakash Rathinam" <gn*******************@oracle.com> 写入消息新闻
:8X************@news.oracle.com...
> Hi Expert,
>
> Is there a way to obtain assembly name in an unmanaged call? During

Interop
> call between managed to unmanaged, I would like to know in unmanaged code > about the caller of assembly file name?
>
> Thanks,
> GP.
>
>



Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.