Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Calling C functions from EasyC (http://www.chiefdelphi.com/forums/showthread.php?t=42764)

koenig3456 27-01-2006 11:07

Calling C functions from EasyC
 
I've written some functions in C using MPLab. The modules include both static data and code. How can I use them in an EasyC project?

dcbrown 27-01-2006 11:23

Re: Calling C functions from EasyC
 
Quote:

Originally Posted by koenig3456
I've written some functions in C using MPLab. The modules include both static data and code. How can I use them in an EasyC project?

I think the answer is wait for next version of EasyC. See thread EasyC Wish List, esp. reply #4.

Regards,
DCBrown

koenig3456 27-01-2006 13:27

Re: Calling C functions from EasyC
 
Thanks for the hint.
I may have figured out a solution. I don't have access to the RC right now, so I can't test it. It does compile and link successfully.

This is what I did:
1. Compile the C code using MPLab.
2. Use mplib.exe to add the .o file to the wpilib.lib in the EasyC folder.
3. Add the header file to EasyC (Options/File Inclusion).

dcbrown 27-01-2006 15:09

Re: Calling C functions from EasyC
 
Clever. I hadn't thought about adding additional .o files to the default library. To use to environments where libraries are protected except for read access.

We have a need for something similar, can't wait to try it.

Regards,
DCBrown

dcbrown 27-01-2006 16:03

Re: Calling C functions from EasyC
 
Tried something similar just now...

1. Use MPLab to create .o object files
2. Use command window, use mplib to create .lib file (mplib /c MyTest.lib)
3. Add .o files to my library (mplib /r MyTest.lib MyTest.o)
3. move a copy of my library MyTest.lib to c:\mcc18\lib so it can be found by EasyC during link time
4. update <processor>.lkr file under EasyC in Frc\18F***\ to reference my library, e.g.

:
FILES clib.lib
FILES p18f8520.lib
FILES MyTest.lib << added this
:

5. Referenced functions/data in MyTest.lib in EasyC... compiled/linked correctly.

Regards,
DCBrown


All times are GMT -5. The time now is 16:19.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi