The functions do not start with underscore or any other common prefix when
viewed in Depends, so I'll presume stdcall.

Thanks for the tip.

-Mont


On 4/30/07, Stoyan Damov <[EMAIL PROTECTED]> wrote:

open the dll in dependency walker (part of sysinternals suite) - if
your functions start with underscore (_) they're almost certain cdecl,
otherwise probably stdcall.

On 4/30/07, Mont Rothstein <[EMAIL PROTECTED]> wrote:
> Thanks for all of the information.  I'll have to dig into this more.
>
> The make file doesn't have a /Gd or a /Gz flag.  I suspect I am going to
> have to contact the vendor about this (though I don't hold out much hope
for
> an answer).
>
> I have C code that calls the same functions and works fine, so I know
the
> functions work, and the DLL does nothing more than define the functions
and
> like to the libraries them are in.
>
> Thanks again,
> -Mont
>
> On 4/30/07, Michael Waldinger <[EMAIL PROTECTED]> wrote:
> >
> > I have a strong recollection that when I did my P/Invoke work a few
months
> > ago, I ran into a problem where I had to look at the calling
convention.
> > So as I recall I think it does matter; it would stand to reason that
you
> > would have to P/Invoke the API using the same calling convention that
the
> > API is built to use.  This may be the root of your problem.  BTW, if
the
> > DLL is being built using a makefile you will want to look for the
compiler
> > switch /Gd for __cdecl and /Gz for __stdcall.  I got this information
from
> > the following website:
> > http://www.codeproject.com/cpp/calling_conventions_demystified.asp
> >
> > I have tried googling this subject using the keywords "__cdecl
pinvoke"
> > and
> > I got  a lot of results; many of them contradicted my earlier
statement
> > that __cdecl is required.
> >
> > I also found this on the dotnet-cx board which sounds a lot like it
> > answers
> > your latest questions:
> >
http://discuss.develop.com/archives/wa.exe?A2=ind0406d&L=dotnet-cx&P=730
> >
> > Unfortunately, you have reached the limit of my knowledge on the
proper
> > calling conventions.  I don't want to give out any more bad
information,
> > except that I think this may be your problem.  Your declarations look
OK
> > to
> > me but again I am unfamiliar with what it takes to get a struct back
as an
> > out parameter.  That would be the only other thing I could suggest you
> > look
> > into.  A third thing to try, if you are familiar with C++, is to write
a
> > C++ test harness to simulate the calls that you are doing in C#, and
make
> > certain that you get the struct popuated with data.  One of the
earlier
> > posters suggested that the DLL was failing internally before it
allocated
> > the struct, which could also be a cause of your problem.
> >
> > On Mon, 30 Apr 2007 08:44:21 -0700, Mont Rothstein
> > <[EMAIL PROTECTED]> wrote:
> >
> > >Thanks for the additional info.
> > >
> > >I am compiling this DLL with VS 05 form the command line.  It uses a
> > >manually created make file and not a project.
> > >
> > >I didn't create the DLL, it is part of a package, which is why I am
> > unclear
> > >on some of this.
> > >
> > >I searched the directory where all of the source is kept for both
> > __stdcall
> > >and __decl with no hits on either.  So I presume it uses whichever is
> > >default for VS.
> > >
> > >I guess I should ask why it matters?  Might the root of this problem
be
> > that
> > >the wrong calling convention is used?  Or might I need to change
someone
> > in
> > >my C# code based on the calling convention?
> > >
> > >Thanks,
> > >-Mont
> >
> > ===================================
> > This list is hosted by DevelopMentor(r)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com
> >
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com
>


--

Cheers,
Stoyan

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to