Hi Manu,
One suggested way around my error is for the DRM wrapper to wrap a DLL
for my game as opposed to the EXE.
This requires me to generate a DLL specific to my EXE and I have used
the 'Dynamic Library Builder' wizard to generate a test DLL based on a
single feature from my code.
Here is the sample feature:
my_feature (d_srface : DIRECT_DRAW_SURFACE7_IMPL_PROXY; x, y : INTEGER;
s_srface : DIRECT_DRAW_SURFACE7_IMPL_PROXY; s : SPRITE; t, b : BOOLEAN)
: INTEGER is
I've successfully generated the DLL and here is the relevant contents
from the generated 'edynlib.c' file:
extern void F1_29 (EIF_REFERENCE);
extern EIF_INTEGER_32 F1643_28402 (EIF_REFERENCE, EIF_REFERENCE ,
EIF_INTEGER_32 , EIF_INTEGER_32 , EIF_REFERENCE , EIF_REFERENCE ,
EIF_BOOLEAN , EIF_BOOLEAN );
EIF_INTEGER_32 my_feature (EIF_REFERENCE d_srface, EIF_INTEGER_32 x,
EIF_INTEGER_32 y, EIF_REFERENCE s_srface, EIF_REFERENCE s, EIF_BOOLEAN
t, EIF_BOOLEAN b)
{ GTCX
/* Creation : F1_29; */
/* Feature : F1643_28402 ;*/
EIF_REFERENCE main_obj = (EIF_REFERENCE) 0;
EIF_INTEGER_32 Return_Value ;
DYNAMIC_LIB_RT_INITIALIZE(4);
RTLR(1,dest_surface);
RTLR(2,sprite_surface);
RTLR(3,sprite);
RTLR(0,main_obj);
main_obj = RTLN(1642);
/* Call the creation routine */
F1_29(main_obj);
/* Call the routine */
Return_Value = (EIF_INTEGER_32)
F1643_28402(main_obj,d_srface,x,y,s_srface,s,t,b);
DYNAMIC_LIB_RT_END;
return (EIF_INTEGER_32) Return_Value;
}
At this point I'm guessing for it to work as expected I need my original
feature to no longer rely on the original code but to reference the DLL
via an 'external; call instead so that the EXE is actually linking to
the DLL at runtime.
Trying my best to follow the C externals documentation I've come up with
the following:
my_feature (d_srface : DIRECT_DRAW_SURFACE7_IMPL_PROXY; x, y : INTEGER;
s_srface : DIRECT_DRAW_SURFACE7_IMPL_PROXY; s : SPRITE; t, b : BOOLEAN)
: INTEGER is
do
Result := cwin_my_feature($d_srface, x, y, $s_srface, $s, t, b)
end
cwin_my_feature (d_srface : POINTER; x, y : INTEGER; s_srface, s :
POINTER; t, b : BOOLEAN) : INTEGER is
-- C external
external
"C [dll32 %"my_dll.dll%"] (EIF_REFERENCE, EIF_INTEGER_32,
EIF_INTEGER_32, EIF_REFERENCE, EIF_REFERENCE, EIF_BOOLEAN, EIF_BOOLEAN)
: EIF_INTEGER_32"
alias
"my_feature"
end
The project compiles and freezes successfully but when 'my_feature' is
called at runtime I receive a 'Visual C++ Runtime Error'. Any help in
tracking down where I've gone wrong would be greatly appreciated as C
externals are definitely not my strength.
Note, I've also experimented with using dllwin32 in the c external call
as well as including the generated 'lib' file under the Advanced
settings when I generated the DLL and all to no avail.
Thanks,
Hubert
Emmanuel Stapf [ES] wrote:
>
>
> Do you have any pointer on the eLicense technical documentation for
> integrating
> their product?
>
> Regards,
> Manu
>
> > -----Original Message-----
> > From:
[hidden email]
> <mailto:eiffel_software%40yahoogroups.com>
> > [mailto:
[hidden email]
> <mailto:eiffel_software%40yahoogroups.com>] On Behalf Of Hubert Cater
> > Sent: Wednesday, September 30, 2009 7:17 AM
> > To:
[hidden email]
> <mailto:eiffel_software%40yahoogroups.com>
> > Subject: Re: [eiffel_software] Re: C Run-Time Error R6002
> >
> > Thanks for your response and the way it works is my executable is
> > wrapped in a process that enables DRM. The EXE then communicates with a
> > DLL called eLicense.dll.
> >
> > It seems that at some point during this communication I receive the
> > floating point error as my guess is the wrapping or the DLL requires the
> > floating point libraries to have been included and compiled in my
> > project.
> >
> > How they wrap it I am not exactly sure but this is their website if it
> > is of any help.
> >
> >
http://www.elicense.com/ <
http://www.elicense.com/>
> >
> > Hubert
> >
> >
> >
> >
> > Emmanuel Stapf [ES] wrote:
> > >
> > >
> > > > It has been suggested that I need to dynamically link the runtime
> > > > libraries with the Multi-threaded DLL /MD flag.
> > > > Would this make any sense?
> > >
> > > It would if indeed the third party library you are using is using /MD.
> > >
> > > > I've tried to use this flag in the ISE_CFLAGS environment variable
> > and
> > > > it overrides the /MT flag but results in numerous C compilation
> > errors.
> > >
> > > Unfortunately using a mix of /MT and /MD will never work in most
> > > scenarios. So if
> > > you have to compile with /MD, you have to recompile everything with
> > /MD,
> > > including
> > > the Eiffel Software runtime and the C counterparts of some Eiffel
> > > libraries. It is
> > > doable but quite a pain.
> > >
> > > Can you remind us how you are including this component into your
> > software?
> > >
> > > Regards,
> > > Manu
> > >
> >
> > --
> > Fury Software
> >
http://www.furysoftware.com <
http://www.furysoftware.com>
> >
> > Battlefront.com
> >
http://www.battlefront.com <
http://www.battlefront.com>
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>
>
>
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.409 / Virus Database: 270.14.1/2407 - Release Date: 10/01/09 06:34:00
>
--
Fury Software
http://www.furysoftware.comBattlefront.com
http://www.battlefront.com