Ecere SDK/eC Forums
https://ecere.org/community/
Print view

Problem when include user C libraries
https://ecere.org/community/viewtopic.php?f=13&t=223
Page 1 of 1
Author:  samsam598 [ Mon Mar 12, 2012 1:35 am ]
Post subject:  Problem when include user C libraries

Greetings!

Sorry for this if you think the similar questions I've asked several time here.

This is a DispHelper library on the net http://sourceforge.net/projects/disphelper/which try to manipulate COM (Excel,Word,Email,etc) under windows.It was written in pure C+win32 API.I tried the sample with pure C (mingw),it compiles;but when I try to include the source file in eC project,'can't find blabla and bla blar ' error message appeared everywhere.Although I've already added ole32.a oleaut32.a and uuid.a to the project,and also I tried to add

Code: Select all

//#define UNICODE
#ifdef __WIN32__
#define WIN32_LEAN_AND_MEAN

#include <windows.h> 
#endif 
import "ecere"

at the beginning of the disphelper.h file.

I've attached the questioned project with the disphelper library source.Could you please provide a simple guidance on how to make it work under eC.Any special concerns one should pay when encounters the same/similar issues next time?

Thanks for your help in advance.

Regards,
Sam
Author:  jerome [ Mon Mar 12, 2012 3:03 am ]
Post subject:  Re: Problem when include user C libraries

Hi Sam,

If you change the top of your main.ec to read:

Code: Select all

#ifdef __WIN32__
// #define WIN32_LEAN_AND_MEAN
#define Method _Method
#define uint _uint
#define byte _byte
#define int64 _int64
#include <windows.h> 
#undef Method
#undef uint
#undef byte
#undef int64
 
#endif 
#include "disphelper.h"
You should be able to compile main.ec.

Then if you want to compile disphelper.c directly in your project, in disphelper.h, comment out #define WIN32_LEAN_AND_MEAN as well.
If this is defined, the COM stuff doesn't get declared by the MinGW headers.

You should also take a look at extras/wia.ec .
It uses the WIA scanning facility through COM objects, using eC classes (it doesn't use disphelper).
You should be able to wrap whichever COM objects the same way...

In fact we hope to have these COM objects binding automated :)
If you have the chance, it would be nice if you can help us get that working!

Regards,

Jerome
All times are UTC-05:00 Page 1 of 1