Problem when include user C libraries

General help specific to the Windows platform.
Post Reply
samsam598
Posts: 212
Joined: Thu Apr 14, 2011 9:44 pm

Problem when include user C libraries

Post by samsam598 »

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
Attachments
dishelperapp.7z
(155.52 KiB) Downloaded 3720 times
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Problem when include user C libraries

Post by jerome »

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
Post Reply