Thread overview
Linking question
Dec 06, 2003
Charles Sanders
Dec 07, 2003
one_mad_alien
Dec 08, 2003
Charles Sanders
Dec 08, 2003
Charles Sanders
Dec 08, 2003
Georg Wrede
December 06, 2003
Hey all,

I have a library that I want to compile that _has_ a WinMain () , and then just have the user compile a 'mainless' program with the compiler , is this possible ?  Im having some undefined mess with it running, if you download http://www.atari-soldiers.com/windy.zip it has makefiles that will build it,

If i compile them all together ( windy.exe ) it runs as expected, but if i compile Windy as a lib, then compile the main.d and link to the lib (windy_lib_main.exe) , it fails with Access Violation.  Please any help is appreciated thanks!

C


December 07, 2003
In article <bqtj93$mtd$1@digitaldaemon.com>, Charles Sanders says...
>
>Hey all,
>
>I have a library that I want to compile that _has_ a WinMain () , and then just have the user compile a 'mainless' program with the compiler , is this possible ?  Im having some undefined mess with it running, if you download http://www.atari-soldiers.com/windy.zip it has makefiles that will build it,
>
>If i compile them all together ( windy.exe ) it runs as expected, but if i compile Windy as a lib, then compile the main.d and link to the lib (windy_lib_main.exe) , it fails with Access Violation.  Please any help is appreciated thanks!
>
>C
I tried some time ago to compile a lib with WinMain that expected and external DFC_main ... but it all failed ... the linker seems to expect Main/WinMain to be in an object file not one of the included libs.

I get that Access Violation lots if I add/remove a member from an included d file that is in a lib, but forget to recompile the lib (the depends in my make file do not cover imports)

check that you are not compiling the lib as debug and the main as release
its late and I'm going to bed soon, but here is the examples from my make file

DMD=c:/dmd/bin/dmd.exe
DMC=c:/dm/bin/dmc.exe
DMLIB=c:/dm/bin/lib.exe
LINK=c:/dm/bin/link.exe
SC=c:/dm/bin/sc.exe

DOPTS=-c -release -O
DFLAGS= $(DOPTS) -I./src
export DFLAGS
DLIBS=phobos.lib snn.lib gc.lib GDI32.LIB KERNEL32.LIB USER32.LIB UUID.LIB
CTL3D32.LIB COMDLG32.LIB COMCTL32.LIB ADVAPI32.LIB OLE32.LIB OLEAUT32.LIB


## console app (winmain but will open a console if double clicked on in
explorer)
$(BIN_DIR)/$(PROJECT_NAME).exe : $(LIB_DEPENDS) $(PROJ_OBJS)
$(LINK) $(OBJS_TO_LINK),$(BIN_DIR)\$(PROJECT_NAME),,$(LIBS_TO_LINK)/noi

## gui app (need that there def file)
$(BIN_DIR)/$(PROJECT_NAME).win.exe: $(BIN_DIR)/$(PROJECT_NAME).exe
$(LINK)
$(OBJS_TO_LINK),$(BIN_DIR)\$(PROJECT_NAME).win.exe,$(BIN_DIR)\$(PROJECT_NAME).win.map,$(LIBS_TO_LINK),app.def/noi




December 08, 2003
hmm ok.

Walter can we get a definitive 'no that is in no way possible', or a 'yes with some massaging' ?

C

<one_mad_alien@hotmail.com> wrote in message news:bqu13f$1han$1@digitaldaemon.com...
> In article <bqtj93$mtd$1@digitaldaemon.com>, Charles Sanders says...
> >
> >Hey all,
> >
> >I have a library that I want to compile that _has_ a WinMain () , and
then
> >just have the user compile a 'mainless' program with the compiler , is
this
> >possible ?  Im having some undefined mess with it running, if you
download
> >http://www.atari-soldiers.com/windy.zip it has makefiles that will build
it,
> >
> >If i compile them all together ( windy.exe ) it runs as expected, but if
i
> >compile Windy as a lib, then compile the main.d and link to the lib (windy_lib_main.exe) , it fails with Access Violation.  Please any help
is
> >appreciated thanks!
> >
> >C
> I tried some time ago to compile a lib with WinMain that expected and
external
> DFC_main ... but it all failed ... the linker seems to expect Main/WinMain
to be
> in an object file not one of the included libs.
>
> I get that Access Violation lots if I add/remove a member from an included
d
> file that is in a lib, but forget to recompile the lib (the depends in my
make
> file do not cover imports)
>
> check that you are not compiling the lib as debug and the main as release its late and I'm going to bed soon, but here is the examples from my make
file
>
> DMD=c:/dmd/bin/dmd.exe
> DMC=c:/dm/bin/dmc.exe
> DMLIB=c:/dm/bin/lib.exe
> LINK=c:/dm/bin/link.exe
> SC=c:/dm/bin/sc.exe
>
> DOPTS=-c -release -O
> DFLAGS= $(DOPTS) -I./src
> export DFLAGS
> DLIBS=phobos.lib snn.lib gc.lib GDI32.LIB KERNEL32.LIB USER32.LIB UUID.LIB
> CTL3D32.LIB COMDLG32.LIB COMCTL32.LIB ADVAPI32.LIB OLE32.LIB OLEAUT32.LIB
>
>
> ## console app (winmain but will open a console if double clicked on in
> explorer)
> $(BIN_DIR)/$(PROJECT_NAME).exe : $(LIB_DEPENDS) $(PROJ_OBJS)
> $(LINK) $(OBJS_TO_LINK),$(BIN_DIR)\$(PROJECT_NAME),,$(LIBS_TO_LINK)/noi
>
> ## gui app (need that there def file)
> $(BIN_DIR)/$(PROJECT_NAME).win.exe: $(BIN_DIR)/$(PROJECT_NAME).exe
> $(LINK)
>
$(OBJS_TO_LINK),$(BIN_DIR)\$(PROJECT_NAME).win.exe,$(BIN_DIR)\$(PROJECT_NAME
).win.map,$(LIBS_TO_LINK),app.def/noi
>
>
>
>


December 08, 2003
Actually it seems to work now , i had a static constructor that was assigning a value to a static member of another class, i moved that into its own static constructor and somehow it seems to work ( using a WinMain in a lib, having the user link in an object file ) .

Im creating some docs right now, only bad thing about the lib is manual placement ( ye old grid system ) of the controls , which I dont think will be a problem given a good resizing system and dialog editor ( using native code none of that .rc crap ).

Im putting it up at http://www.atari-soldiers.com/gpage.html1.html .

Its very easy to use and even easier to extend, everything's just a Window so you can do whatever you like, and with some manipulation you can even create floating controls on the desktop .

P.S. its not complete, im still wrapping some of the controls but expect a usable version within a week or so.  Could anyone reading this download it and report build problems ?

Thanks
C

"Charles Sanders" <sanders-consulting@comcast.net> wrote in message news:br0f0r$273d$1@digitaldaemon.com...
> hmm ok.
>
> Walter can we get a definitive 'no that is in no way possible', or a 'yes with some massaging' ?
>
> C
>
> <one_mad_alien@hotmail.com> wrote in message news:bqu13f$1han$1@digitaldaemon.com...
> > In article <bqtj93$mtd$1@digitaldaemon.com>, Charles Sanders says...
> > >
> > >Hey all,
> > >
> > >I have a library that I want to compile that _has_ a WinMain () , and
> then
> > >just have the user compile a 'mainless' program with the compiler , is
> this
> > >possible ?  Im having some undefined mess with it running, if you
> download
> > >http://www.atari-soldiers.com/windy.zip it has makefiles that will
build
> it,
> > >
> > >If i compile them all together ( windy.exe ) it runs as expected, but
if
> i
> > >compile Windy as a lib, then compile the main.d and link to the lib (windy_lib_main.exe) , it fails with Access Violation.  Please any help
> is
> > >appreciated thanks!
> > >
> > >C
> > I tried some time ago to compile a lib with WinMain that expected and
> external
> > DFC_main ... but it all failed ... the linker seems to expect
Main/WinMain
> to be
> > in an object file not one of the included libs.
> >
> > I get that Access Violation lots if I add/remove a member from an
included
> d
> > file that is in a lib, but forget to recompile the lib (the depends in
my
> make
> > file do not cover imports)
> >
> > check that you are not compiling the lib as debug and the main as
release
> > its late and I'm going to bed soon, but here is the examples from my
make
> file
> >
> > DMD=c:/dmd/bin/dmd.exe
> > DMC=c:/dm/bin/dmc.exe
> > DMLIB=c:/dm/bin/lib.exe
> > LINK=c:/dm/bin/link.exe
> > SC=c:/dm/bin/sc.exe
> >
> > DOPTS=-c -release -O
> > DFLAGS= $(DOPTS) -I./src
> > export DFLAGS
> > DLIBS=phobos.lib snn.lib gc.lib GDI32.LIB KERNEL32.LIB USER32.LIB
UUID.LIB
> > CTL3D32.LIB COMDLG32.LIB COMCTL32.LIB ADVAPI32.LIB OLE32.LIB
OLEAUT32.LIB
> >
> >
> > ## console app (winmain but will open a console if double clicked on in
> > explorer)
> > $(BIN_DIR)/$(PROJECT_NAME).exe : $(LIB_DEPENDS) $(PROJ_OBJS)
> > $(LINK) $(OBJS_TO_LINK),$(BIN_DIR)\$(PROJECT_NAME),,$(LIBS_TO_LINK)/noi
> >
> > ## gui app (need that there def file)
> > $(BIN_DIR)/$(PROJECT_NAME).win.exe: $(BIN_DIR)/$(PROJECT_NAME).exe
> > $(LINK)
> >
>
$(OBJS_TO_LINK),$(BIN_DIR)\$(PROJECT_NAME).win.exe,$(BIN_DIR)\$(PROJECT_NAME
> ).win.map,$(LIBS_TO_LINK),app.def/noi
> >
> >
> >
> >
>
>


December 08, 2003
In article <br0f0r$273d$1@digitaldaemon.com>, Charles Sanders says...
>Walter can we get a definitive 'no that is in no way possible', or a 'yes with some massaging' ?
>> >I have a library that I want to compile that _has_ a WinMain () , and
>then just have the user compile a 'mainless' program with the compiler,
> is this possible ?  Im having some undefined mess with it running, if you download http://www.atari-soldiers.com/windy.zip it has makefiles that will build

Isn't the existence of a WinMain a Windows specific thing? I mean, it may not be at all possible to _have_ a WinMain in a dll?

I'm no guru at this, but what if you told the library users to have an otherwise empty WinMain that just calls AtariSoldiersDllMain?