Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
170 user(s) are online (154 user(s) are browsing Forums)

Members: 3
Guests: 167

hlt, Mr_byte, sailor, more...

Support us!

Headlines

 
  Register To Post  

« 1 (2) 3 »
Re: C Extern functions
Home away from home
Home away from home


See User information
@freddix

that's very odd. did you try cahneging the position of lAmiDark as I suggesed?

What does

objdump -t libAmiDark.o

give?

Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
@broadblues

libamidark.o:     file format elf32-amigaos

SYMBOL TABLE
:
00000000 l    df *ABS*    00000000 libAmiDARK.c
00000000 l    d  
.text    00000000 .text
00000000 l    d  
.data    00000000 .data
00000000 l    d  
.bss    00000000 .bss
000001b8 l     F 
.text    00000014 MyReshapeFunc
00000fe0 l     F 
.text    000006e4 UpdateImage
000016c4 l     F 
.text    00000b08 INTERNAL_Trace3DObject
000021cc l     F 
.text    00000714 MyDisplayFunc
00000000 l    d  
.rodata    00000000 .rodata
00000000 l     O 
.bss    00000200 jmpbuf
00000000 l    d  
.rodata.cst4    00000000 .rodata.cst4
00000000 l    d  
.rodata.cst8    00000000 .rodata.cst8
00000000 l    d  
.rodata.str1.4    00000000 .rodata.str1.4
00000000 l    d  
.sbss    00000000 .sbss
00000000 l    d  
.sdata    00000000 .sdata
00000000 l    d  
.stab    00000000 .stab
00000000 l    d  
.stabstr    00000000 .stabstr
00000000 l    d  
.comment    00000000 .comment
00000000 g     F 
.text    0000001c DEG2RAD
0000001c g     F 
.text    0000001c RAD2DEG
00000038 g     F .text    00000010 DEVal
00000048 g     F .text    00000054 DESetMaximumTextures
00000004       O 
*COM*    00000004 MaxTextureAmount
00000000         
*UND*    00000000 mini_CurrentContext
00000400       O 
*COM*    00000004 ImageTexture
0000009c g     F .text    00000010 BASIC2D_Constructor
0000000c       O 
*COM*    00000004 Basic2D
000000ac g     F 
.text    00000004 BASIC2D_Destructor
000000b0 g     F 
.text    00000098 DeSetAmbientColor
00000044       O 
*COM*    00000004 AmbientLight
00000148 g     F .text    00000070 DESetDirectionalLight
000001c0       O 
*COM*    00000004 Lights
00000120       O 
*COM*    00000004 BasicSetup
000001cc g     F 
.text    00000044 DESyncOn
00000004       O 
*COM*    00000004 IsSyncOn
00000210 g     F 
.text    00000060 MyMouseFunc
00000020       O 
*COM*    00000004 DBMouse
00000270 g     F 
.text    00000020 MyKeyboardFunc
00000016       O 
*COM*    00000002 DBKey
00000290 g     F .text    00000008 MySpecialFunc
00000298 g     F .text    00000004 MyEntryFunc
0000029c g     F .text    000000a4 ConvertRes2String
00000000         
*UND*    00000000 sprintf
00000340 g     F 
.text    00000044 DebugMessage
00000008 g     O .sbss    00000004 GlobalDEBUG
00000000         
*UND*    00000000 printf
00000384 g     F .text    00000020 DeleteString
00000000         
*UND*    00000000 free
000003a4 g     F 
.text    00000024 CreateString
00000000         
*UND*    00000000 malloc
000003c8 g     F 
.text    00000048 CreateDeleteString
00000410 g     F 
.text    00000128 INTERNAL_SetTriangleNormal
00000400       O 
*COM*    00000004 MemblockSIZE
00000400       O 
*COM*    00000004 MemblockPTR
00000538 g     F .text    00000044 DESyncOff
0000057c g     F 
.text    00000250 UpdateCamera
00000200       O 
*COM*    00000004 Camera
000007cc g     F 
.text    000002b4 DESaveObject
00000008       *COM*    00000004 Basic3D
00000004       O 
*COM*    00000004 ObjectList
00000400       O 
*COM*    00000004 FileChannel
00000000         
*UND*    00000000 IDOS
00000a80 g     F 
.text    00000560 DELoadObject
00000000         
*UND*    00000000 IExec
00000004       O 
*COM*    00000004 ImageCount
00011c00       O 
*COM*    00000004 ImageData
00000004       O 
*COM*    00000004 TraceImages
00000024       O 
*COM*    00000004 BasicFOG
0000000c       O 
*COM*    00000004 Core
00000000         
*UND*    00000000 __glut_current_context
00000010 g     O 
.sbss    00000002 jmp_set
00000000         
*UND*    00000000 longjmp
000028e0 g     F 
.text    00000c10 main
00000004       O 
*COM*    00000004 argc
00000004       O 
*COM*    00000004 argv
00000400       O 
*COM*    00000004 MeshSIZE
00000400       O 
*COM*    00000004 MeshPTR
00000004       O 
*COM*    00000004 CurrentCamera
00000004       O 
*COM*    00000004 ImageListAmount
00000000         
*UND*    00000000 DarkLoop
00000000 g     O 
.sbss    00000002 DBQuit
00000004 g     O 
.sbss    00000004 window
0000000c g     O 
.sbss    00000004 MyDBWindow
00000000 g     O 
.data    00000010 CoreRGBColor
00000000 g     O 
.sdata    00000004 font
0000000c       O 
*COM*    00000004 vec0
0000000c       O 
*COM*    00000004 vec1
0000000c       O 
*COM*    00000004 vec2
0000000c       O 
*COM*    00000004 normal
0000000c       O 
*COM*    00000004 edge1
0000000c       O 
*COM*    00000004 edge2
00000010       O 
*COM*    00000004 BasicCamera
00000400       O 
*COM*    00000004 MeshSize


What I can see in that list are some functions and some variables ... not all in both cases ...

EDIT : I've removed the MiniGL sample optimisation and -gstabd option in compilation and now .a file is 1/2 size and when I list it, all functions appeared. But the result remain the same on compilation ... Does someone have a clue ?


Edited by freddix on 2009/10/26 23:48:36
All we have to decide is what to do with the time that is given to us.
Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
@freddix

My thought on this mess

Explanation to your first problem:
When compiling something into an .o file you need to supply the -c flag to prevent the compiler from trying to make an executable. Without -c it tries to link it into an executable which requires main(). The -c flag stops after compiling and the result is an .o file.

Also, you don't need to declare any function as extern, just a simple prototype is fine, such as:
void DarkLoop( void );

With ar I always use rc, that is:
ar rc libmyobj.a myobj.o

Don't know what 'cru' does or if that is the cause of your link problems.

Software developer for Amiga OS3 and OS4.
Develops for OnyxSoft and the Amiga using E and C and occasionally C++
Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
@Deniil
I only followed what was rpoposed to me to compile at a .a file
I will make tests following your advice and tell you the result.

EDIT:
I've made tests removing cru and adding rc like you said ...

When I create my libAmiDARK.a using your advices, if I compile a code that use my libAmiDARK.a file, I get this :

gcc -mcrt=newlib  -Wall -DMINIGL   --o AmiDE_3D[MultiCamera].o AmiDE_3D[MultiCamera].c
AmiDE_3D
[MultiCamera].cIn function 'DarkLoop':
AmiDE_3D[MultiCamera].c:48warningimplicit declaration of function 'DESetDisplayMode'
AmiDE_3D[MultiCamera].c:50warningimplicit declaration of function 'DELoadImage'
AmiDE_3D[MultiCamera].c:51warningimplicit declaration of function 'DEMakeObjectBox'
AmiDE_3D[MultiCamera].c:52warningimplicit declaration of function 'DELoadObject'
AmiDE_3D[MultiCamera].c:53warningimplicit declaration of function 'DEPositionObject'
AmiDE_3D[MultiCamera].c:54warningimplicit declaration of function 'DEColorObjectEx'
AmiDE_3D[MultiCamera].c:55warningimplicit declaration of function 'DETextureObject'
AmiDE_3D[MultiCamera].c:65warningimplicit declaration of function 'DELoop'
AmiDE_3D[MultiCamera].c:68warningimplicit declaration of function 'DESync'
gcc -mcrt=newlib  -Wall -DMINIGL --lAmiDARK -lGL -lGLUT -lglpng -lpng -lz   -o AmiDE_3D_MultiCameras.exe.debug AmiDE_3D[MultiCamera].o
/SDK/newlib/lib/crtbegin.oIn function `_start':
(.text+0x14e): undefined reference to 
`main'
/SDK/newlib/lib/crtbegin.o: In function `_start'
:
(.
text+0x156): undefined reference to `main'
AmiDE_3D[MultiCamera].o: In function 
`DarkLoop':
AmiDE_3D[MultiCamera].c:(.text+0x24): undefined reference to `DESetDisplayMode'
AmiDE_3D[MultiCamera].c:(.text+0x38): undefined reference to `DELoadImage'
AmiDE_3D[MultiCamera].c:(.text+0x68): undefined reference to 
`DEMakeObjectBox'
AmiDE_3D[MultiCamera].c:(.text+0x7c): undefined reference to `DELoadObject'
AmiDE_3D[MultiCamera].c:(.text+0xac): undefined reference to `DEPositionObject'
AmiDE_3D[MultiCamera].c:(.text+0xc4): undefined reference to 
`DEColorObjectEx'
AmiDE_3D[MultiCamera].c:(.text+0xd4): undefined reference to `DETextureObject'
AmiDE_3D[MultiCamera].c:(.text+0x104): undefined reference to `DEMakeObjectBox'
AmiDE_3D[MultiCamera].c:(.text+0x134): undefined reference to 
`DEPositionObject'
AmiDE_3D[MultiCamera].c:(.text+0x14c): undefined reference to `DEColorObjectEx'
AmiDE_3D[MultiCamera].c:(.text+0x160): undefined reference to `DELoadImage'
AmiDE_3D[MultiCamera].c:(.text+0x178): undefined reference to 
`DEMakeObjectBox'
AmiDE_3D[MultiCamera].c:(.text+0x188): undefined reference to `DETextureObject'
AmiDE_3D[MultiCamera].c:(.text+0x1ac): undefined reference to `DESync'
AmiDE_3D[MultiCamera].c:(.text+0x1b0): undefined reference to 
`DELoop'
make: *** [AmiDE_3D_MultiCameras.exe] Error 1


the makefile is :
# GLUT-fullscreen template
#
# See GLUT-fullscreen.c and GLUT-fullscreen2.c for details
#
# written by Hans de Ruiter
#
# License:
# This is provided as-is and can be used and distributed by anyone
# without restrictions.

CC     gcc
CP       
copy
RM     
delete
STRIP  
strip

//OPTIMIZE = -O3
OPTIMIZE 
DEBUG =
CFLAGS = -mcrt=newlib $(OPTIMIZE) -Wall -DMINIGL

TARGET 
AmiDE_3D_MultiCameras.exe

# The source files
SRCS AmiDE_3D[MultiCamera].c

# Flags passed to gcc during linking
LINK =

# Additional linker libraries
LIBS = --lAmiDARK -lGL -lGLUT -lglpng -lpng -lz 

# -------------------------------------------------------------
# Nothing should need changing below this line

OBJS = $(SRCS:.c=.o)

# Rules for building
all: $(TARGET)

$(
TARGET): $(OBJS)
    $(
CC) $(CFLAGS) $(LIBS) $(LINK) -$@.debug $(OBJS
    $(
STRIP) $@.debug -$@

.
PHONYclean
clean
:
    $(
RM) $(TARGET) $(TARGET).debug $(OBJS)


Edited by freddix on 2009/10/28 13:26:10
All we have to decide is what to do with the time that is given to us.
Go to top
Re: C Extern functions
Home away from home
Home away from home


See User information
@Deniil

Quote:

Also, you don't need to declare any function as extern, just a simple prototype is fine, such as:
void DarkLoop( void );


Err, you should declare function calls in a shared header with extern....

The only time you might not use extern is if you a decalring a prototype in the same file as afunction because you need to call it before it's defined.

'cru' does the same as 'rc' except that the 'u' means only update newer files. I don't think order of options is critical.

@Fredix

Please delete / (or backup by renaming) all objects files and archives ie libAmiDark.a and rebuild from scratch.

Post all you output here.....

Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
@freddix

You know when a compiler issues a warning that's not just to disturb you : you *should* understand what the warning report to and be sure to understand why you choose not to correct it (which should really be rare : each warning must be corrected).

Here the warnings you got when compiling your AmiDE_3D[MultiCamera].c file tells me that you are calling functions without first defining them. In such a case, the compiler will assume a default prototype signature usually it will assume the function returns an int, as a consequence when linking it will search for a function returning an int if the real function is returning something else it will not find it and tell you it has undefined references.

Now how to correct that : start by writing an header called AmiDARK.h (for example) in this header you should put every function (and variable?) your AmiDARK engine wants to share externaly, one small example
#ifndef AMIDARK_H
#define AMIDARK_H

extern void DESync(void);
extern int DEPositionObject(DEObject object);
...

#endif /* AMIDARK_H */


This header will be included by the source files of your engine *and* by the user code so this header will be something you'll provide in your SDK (just like proto/exec.h for example) don't put in it something you want to keep internal to your engine, instead write another header file (for example AmiDARKprivate.h where you'll put anything private to your implementation).
AFAIK your engine is written in whole in an unique C file so the private header won't be required because internal things will be defined at the start of this file, but when your engine will grow dramatically you might find convenient to split this monster file into smaller files at this point you will have a need for the private header.

About the ar commandline as it was me that gave the advice I apologize I did it from memory in fact the option order matters so I intended 'ruc' instead of 'cru', sorry.


Edited by abalaban on 2009/10/29 13:49:34
Back to a quiet home... At last
Go to top
Re: C Extern functions
Home away from home
Home away from home


See User information
@abalaban

Quote:

Here the warnings you got when compiling your AmiDE_3D[MultiCamera].c file tells me that you are calling functions without first defining them. In such a case, the compiler will assume a default prototype signature usually it will assume the function returns an int, as a consequence when linking it will search for a function returning an int if the real function is returning something else it will not find it and tell you it has undefined references.

You are ofcourse correct to say he should be defineing his functions in advance, but that won't result in unfound symbols (unless he's compiling with g++)

In fact under C it could be worse, the functions might be miscalled, with wrong types, leading to apprently inexplcable crashes.

Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
@broadblues

Quote:

You are ofcourse correct to say he should be defineing his functions in advance, but that won't result in unfound symbols (unless he's compiling with g++)

In fact under C it could be worse, the functions might be miscalled, with wrong types, leading to apprently inexplcable crashes.


Are you sure ? I can't test right now but I would have sworn that not defining a function before it's called would lead you to undefined (not found) symbols especially when dealing with functions from a static library and this function does not return an int.

Back to a quiet home... At last
Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
EDIT : Sorry for the double post..
It said me that session was invalid ..

All we have to decide is what to do with the time that is given to us.
Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
Hi All and thank you for your answers :)

I already do this.
Here is the AmiDARK.h file content :
#ifndef _AMIDARK_H_
#define _AMIDARK_H_

extern void DarkENGINE_Startvoid );
extern void DarkENGINE_Endvoid );
extern int DELoopvoid );
extern int mainint myargcchar** myargv );

extern void DESetDisplayModeint Widthint Heightint Depth );
extern void DELoadImage( const char FileNameint ImageIndex );
extern void DEMakeObjectBoxint ObjectIDint Widthint Heightint Depth );
extern void DELoadObjectchar FileNameint ObjectID );
extern void DEPositionObjectint ObjectIDfloat XPosfloat YPosfloat ZPos );
extern void DEColorObjectExint ObjectIDint RGBRint RGBGint RGBB );
extern void DETextureObjectint ObjectIDint ImageID );
extern void DESync();


When I include this file, only the warning disappear and I always get this :
gcc -mcrt=newlib  -Wall -DMINIGL   --o AmiDE_3D[MultiCamera].o AmiDE_3D[MultiCamera].c
gcc 
-mcrt=newlib  -Wall -DMINIGL --lAmiDARK -lGL -lGLUT -lglpng -lpng -lz   -o AmiDE_3D_MultiCameras.exe.debug AmiDE_3D[MultiCamera].o
/SDK/newlib/lib/crtbegin.oIn function `_start':
(.text+0x14e): undefined reference to 
`main'
/SDK/newlib/lib/crtbegin.o: In function `_start'
:
(.
text+0x156): undefined reference to `main'
AmiDE_3D[MultiCamera].o: In function 
`DarkLoop':
AmiDE_3D[MultiCamera].c:(.text+0x20): undefined reference to `DESetDisplayMode'
AmiDE_3D[MultiCamera].c:(.text+0x30): undefined reference to `DELoadImage'
AmiDE_3D[MultiCamera].c:(.text+0x44): undefined reference to 
`DEMakeObjectBox'
AmiDE_3D[MultiCamera].c:(.text+0x54): undefined reference to `DELoadObject'
AmiDE_3D[MultiCamera].c:(.text+0x78): undefined reference to `DEPositionObject'
AmiDE_3D[MultiCamera].c:(.text+0x8c): undefined reference to 
`DEColorObjectEx'
AmiDE_3D[MultiCamera].c:(.text+0x98): undefined reference to `DETextureObject'
AmiDE_3D[MultiCamera].c:(.text+0xac): undefined reference to `DEMakeObjectBox'
AmiDE_3D[MultiCamera].c:(.text+0xd4): undefined reference to 
`DEPositionObject'
AmiDE_3D[MultiCamera].c:(.text+0xe8): undefined reference to `DEColorObjectEx'
AmiDE_3D[MultiCamera].c:(.text+0xf8): undefined reference to `DELoadImage'
AmiDE_3D[MultiCamera].c:(.text+0x10c): undefined reference to 
`DEMakeObjectBox'
AmiDE_3D[MultiCamera].c:(.text+0x118): undefined reference to `DETextureObject'
AmiDE_3D[MultiCamera].c:(.text+0x13c): undefined reference to `DESync'
AmiDE_3D[MultiCamera].c:(.text+0x140): undefined reference to 
`DELoop'
make: *** [AmiDE_3D_MultiCameras.exe] Error 1


EDIT:
@Abalaban : My source code is splitted in several source code files :
/* AmiDARK Engine Internal functions */
#include "AmiDE Libs/InternalFunctions.c"

/* AmiDARK Engine specific functions sets includes */
#include "AmiDE Libs/Vector3_Static.c"
#include "AmiDE Libs/system_Static.c"
#include "AmiDE Libs/setup_Static.c"
#include "AmiDE Libs/image_Static.c"
#include "AmiDE Libs/memblock_Static.c"
#include "AmiDE Libs/file_Static.c"
#include "AmiDE Libs/camera_Static.c"
#include "AmiDE Libs/Basic2D_Static.c"
#include "AmiDE Libs/Mesh_Static.c"
#include "AmiDE Libs/Basic3D_Static.c"
#include "AmiDE Libs/Light_Static.c"
#include "AmiDE Libs/core_Static.c"
#include "AmiDE Libs/Input_Static.c"
/* Files containing the function themselves */
#include "AmiDE Libs/Vector3.c"
#include "AmiDE Libs/system.c"
#include "AmiDE Libs/setup.c"
#include "AmiDE Libs/image.c"
#include "AmiDE Libs/memblock.c"
#include "AmiDE Libs/file.c"
#include "AmiDE Libs/camera.c"
#include "AmiDE Libs/Basic2D.c"
#include "AmiDE Libs/Mesh.c"
#include "AmiDE Libs/Basic3D_ObjectsSetup.c"
#include "AmiDE Libs/Basic3D_ObjectsMeshes.c"
#include "AmiDE Libs/Basic3D_EngineInformations.c"
#include "AmiDE Libs/Basic3D.c"
#include "AmiDE Libs/Light.c"
#include "AmiDE Libs/core.c"
#include "AmiDE Libs/Input.c"


If I'm not wrong, I must in my #include "AmiDE Libs/......_Static.c" files define functions as extern and not static too ?

All we have to decide is what to do with the time that is given to us.
Go to top
Re: C Extern functions
Home away from home
Home away from home


See User information
@freddix

Hang on a minute, if you code is separated into lots of files as above, how come you only have one libAmiDark.o inside libAmiDark.a ?

Have linked an executable then put that in the archive? That will explain why nothing is working!

You need to compile each of you object files separately then put those in the archive.....

BTW you shouldn't declare main() in your own header file, it's a builtin, if it's prototyped anywhere it would be in stdlib.h I think.

Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
@broadblues

no
The file that is compiled into the .a contain all includes listed below
so it's similar to like if it was only 1 file.

Here is the details :

MakeFile :
# GLUT-fullscreen template
#
# See GLUT-fullscreen.c and GLUT-fullscreen2.c for details
#
# written by Hans de Ruiter
#
# License:
# This is provided as-is and can be used and distributed by anyone
# without restrictions.

CC     gcc
CP       
copy
RM     
delete
STRIP  
strip

// OPTIMIZE = -O3
OPTIMIZE 
DEBUG =
CFLAGS = -mcrt=newlib $(OPTIMIZE) -Wall -DMINIGL

TARGET 
libAmiDARK.a

# The source files
SRCS libAmiDARK.c

# Flags passed to gcc during linking
LINK =

# Additional linker libraries
LIBS = -lGL -lGLUT -lglpng -lpng -lz

# -------------------------------------------------------------
# Nothing should need changing below this line

OBJS = $(SRCS:.c=.o)

# Rules for building
all: $(TARGET)

$(
TARGET): $(OBJS)
    $(
ARrc $@ $^
    
RANLIB $@ 

.
PHONYclean
clean
:
    $(
RM) $(TARGET) $(TARGET).debug $(OBJS)

Makefile compiles the libAmiDARK.c to libAmiDARK.a

Main C file caled libAmiDARK.c :
/***********************************************************
**
** AmiDARK Engine Development Project
**------------------------------------
**
** Sample : Textures/Images demonstration
** Author : Frederic Cordier
** Date :   2009JUI22-043821 **
************************************************************
*/

#include "AmiDARKEngine.c"


File AmiDARKEngine.c:
/* Need : LibPNG-1.2.23 & ZLib-1.2.3 */

/* OpenGL / MiniGL includes */
#include <gl/glut.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

/* AmigaOS4 specific includes */
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/timer.h>
#include <proto/keymap.h>
#include <devices/input.h>
#include <devices/inputevent.h>
#include <devices/timer.h>
#include <interfaces/glut.h>
#include <intuition/intuition.h>

int argc;
char** argv;
BOOL DBQuit FALSE;

// static int __glutWindow = 1;

extern struct MiniGLIFace *IMiniGL;
extern struct IntuitionIFace *__IIntuition;
extern struct TimerIFace *__ITimer;
extern struct KeymapIFace *__IKeymap;
struct Window *window NULL;

TimerHooktimerhook_new(struct MsgPort *timerPort);
void timerhook_delete(TimerHook *timerHook);


static 
void DarkLoopvoid );
static 
void DarkENGINE_Startvoid );
static 
void DarkENGINE_Endvoid );
static 
BOOL DELoopvoid );

int GlobalDEBUG 0;

/* AmiDARK Engine Internal functions */
#include "AmiDE Libs/InternalFunctions.c"

/* AmiDARK Engine specific functions sets includes */

#include "AmiDE Libs/Vector3_Static.c"
#include "AmiDE Libs/system_Static.c"
#include "AmiDE Libs/setup_Static.c"
#include "AmiDE Libs/image_Static.c"
#include "AmiDE Libs/memblock_Static.c"
#include "AmiDE Libs/file_Static.c"
#include "AmiDE Libs/camera_Static.c"
#include "AmiDE Libs/Basic2D_Static.c"
#include "AmiDE Libs/Mesh_Static.c"
#include "AmiDE Libs/Basic3D_Static.c"
#include "AmiDE Libs/Light_Static.c"
#include "AmiDE Libs/core_Static.c"
#include "AmiDE Libs/Input_Static.c"

#include "AmiDE Libs/Vector3.c"
#include "AmiDE Libs/system.c"
#include "AmiDE Libs/setup.c"
#include "AmiDE Libs/image.c"
#include "AmiDE Libs/memblock.c"
#include "AmiDE Libs/file.c"
#include "AmiDE Libs/camera.c"
#include "AmiDE Libs/Basic2D.c"
#include "AmiDE Libs/Mesh.c"
#include "AmiDE Libs/Basic3D_ObjectsSetup.c"
#include "AmiDE Libs/Basic3D_ObjectsMeshes.c"
#include "AmiDE Libs/Basic3D_EngineInformations.c"
#include "AmiDE Libs/Basic3D.c"
#include "AmiDE Libs/Light.c"
#include "AmiDE Libs/core.c"
#include "AmiDE Libs/Input.c"

void DarkENGINE_Startvoid ){
  
SYSTEM_Constructor();
  
SETUP_Constructor();
  
MEMBLOCK_Constructor();
  
CORE_Constructor();
  
INPUT_Constructor();
  
MESH_Constructor();
  
BASIC3D_Constructor();
  
LIGHT_Constructor();
  
CAMERA_Constructor();
  
BASIC2D_Constructor();
  
IMAGE_Constructor();
  
INPUT_Constructor();
 }

void DarkENGINE_Endvoid ){
  
INPUT_Destructor();
  
IMAGE_Destructor();
  
BASIC2D_Destructor();
  
CAMERA_Destructor();
  
LIGHT_Destructor();
  
BASIC3D_Destructor();
  
MESH_Destructor();
  
INPUT_Destructor();
  
CORE_Destructor();
  
MEMBLOCK_Destructor();
  
SETUP_Destructor();
  
SYSTEM_Destructor();
 }

int mainint myargcchar** myargv ){
  
argc myargc;
  
argv myargv;
  
DarkENGINE_Start();
  
DarkLoop();
  
DarkENGINE_End();
  return 
EXIT_SUCCESS;
 }

BOOL DELoop(){    
  
int done DBKey.Escape;
  
 
  return 
done;
 }

Main is defined here because it is used to activate the system and then user need to use DarkLoop function instead of main when developing under AmiDARK Engine.
All includes are here so all is included in this project. It similar to like if it was only 1 big file :p

Regards,
Fred

All we have to decide is what to do with the time that is given to us.
Go to top
Re: C Extern functions
Home away from home
Home away from home


See User information
@freddix

Okay. I wouldn't recomend extending that approach to far, it's better keep your objects seperate, so that if a program links against your library, it doesn't require all functionailty, then it doesn't draw in all the code. Thus making a smaller more efficient system.

So all I can recomend is you try doing a 'make clean', then 'make all' again.

Post the output here so we can make sure the corect files are being generated.

Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
@broadblues
Exactly the same results.

All we have to decide is what to do with the time that is given to us.
Go to top
Re: C Extern functions
Home away from home
Home away from home


See User information
@freddix

I've seen your ouput for the testapp, but I'm not sure that I've seen the make output for your library, it's this I want to see, it may not tell anything, but it'll eliminate possibilities.

Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information

All we have to decide is what to do with the time that is given to us.
Go to top
Re: C Extern functions
Home away from home
Home away from home


See User information
@freddix

i don't know what's up ... random stab in the dark (no pun intended) None of those mising smbols are declared 'static' are they?

if they were they wouldn't show up in the library.

Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
@broadblues
in fact, all includes that contain "_static.c" contain a static definition of a function
That mean that these functions are defined

static ...

in the original files.
Is it a problem ?

All we have to decide is what to do with the time that is given to us.
Go to top
Re: C Extern functions
Home away from home
Home away from home


See User information
@freddix

Quote:

in fact, all includes that contain "_static.c" contain a static definition of a function
That mean that these functions are defined

static ...

in the original files.
Is it a problem ?


Quite possibly. If a function is intended to be visable outside the object file it's compiled, let alone aout side your library, then it must not be declared static.

I would have thought that you get a warning when building your library though.

In fact a here quick test gives an error in that case...

ram:test.c:5: error: static declaration of 'foo' follows non-static declaration
ram:test.c:1: error: previous declaration of 'foo' was here

So I'm not sure if that's your probem or not.

Go to top
Re: C Extern functions
Quite a regular
Quite a regular


See User information
@broadblues
is there a way to declare a function without putting it as static ?

EDIT:
I've removed all static and prototyped all functions without static.

Same result ...

All we have to decide is what to do with the time that is given to us.
Go to top

  Register To Post
« 1 (2) 3 »

 




Currently Active Users Viewing This Thread: 4 ( 0 members and 4 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project