[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trying again to write dll for ts6



PureBytes Links

Trading Reference Links

On Thu, 23 May 2002, Gary Fritz wrote:

> > Secondly, if you are using C++, you have to know that function
> > names are normally "mangled". 
> 
> Mike took care of that with the 'extern "C"' declaration.
> 
> > The error I receive from TS6 when this indicator is turned on is:
> > The instruction at "0x03764e3c" referenced memory at "0x00000001".
> > The memory could not be "read". 
> 
> I haven't done much DLL work, and none with TS6, but:  that's a 
> runtime error that probably means you were referencing an invalid 
> pointer.  It looks like the pointer had a value of "1" instead of a 
> valid address.
> 
> One possibililty is that your fopen() call failed.  But I think 
> fopen() returns NULL for failures, not 1.  In any case it's a good 
> idea to error-check your return values before you reference the 
> pointer.
> 
> I think the problem is in your fprintf().  You print "group" with a 
> %s (string) directive, but "group" is an int -- with a value of 1, 
> hmmmm.  %s expects a pointer to a string.  It tried to indirect 
> through the value you passed it -- 1 -- and barfed.
> 
> Gary
> 

All good suggestions. I think I'm closer. On one of my prints
from the function I get a wierd number first, then the next
two are numbers I expect. I think that for calling the external
dll that TS6 wants the function to be declared with the pascal
calling convention. This seems to be using the __stdcall in
VC5. But when I turn on __stdcall for all functions, it then
mangles the name of the function such that TS6 cannot find
the function.  I'm trying to find what is causing the extra
mangling of names in VC5.

Mike