Can I have a real main() ?
I'm trying to add some graphics features to a C++ program for scientific
calculation that I wrote some time ago. I chose V because it seemed easy
to learn and portable.
So far, I've been able to use the vTextCanvasPane to display the numerical
results, and the vCanvasPane to plot the graphics. The problem is that I'm
not able to put the 2 different canvases in the same application;
First of all, thanks to Bruce Wampler, Nikolai Tkachenko and Tom Hilinski
for their precious help.
Now my Test application has two vCmdWindows (a vTextEditor and a
vCanvasPane); yesterday I used them to display the entries of a matrix and
the plot of a cosine, and they worked all right. It seemed to me that my
problems were over, so I started to add my C++ classes (the ones that make
the actual calculation), to the Test app.
Here I've found out that I have a horrible problem: my classes need to link
various local math libraries that we have here at Department of Mechanics;
they are very old ones, automatically translated by F2c from Fortran to C,
so they need to link the well-known libF2c.a library, that provides them
with the proper environment (typedefs, function calls, defines, etc.)
The problem is that libF2c.a needs that somewhere a function main() is defined:
g++ -o ter.exe -O -LC:/cygwin/v/lib -L/local/lib ./terapp.o ./tercnv.o
.o ./tedcnv.o ./tedcmdw.o ./matrici.o -lsysln -leigen -lalloc -lF2c -lV
ing: cannot find entry symbol _WinMainCRTStartup; defaulting to 00401000
/local/lib/libF2c.a(main.o)(.text+0x1a4):main.c: undefined reference to
collect2: ld returned 1 exit status
make: *** [ter.exe] Error 1
If I add a fake main
anywhere in the code, the program links without errors, but then it does
nothing. I understand that this is due to the fact that some sort of main
for my V application is provided at linktime by the operating system, if
none is found.
So my question is: is it possible to force the linker to override the fake
main, so that I can cheat libF2c.a, and have the V appMain started as well?