delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/21/17:24:48

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <20010521212023.30056.qmail@web14507.mail.yahoo.com>
Date: Tue, 22 May 2001 07:20:23 +1000 (EST)
From: =?iso-8859-1?q?Danny=20Smith?= <danny_r_smith_2001 AT yahoo DOT co DOT nz>
Subject: Re: Linking with MAPI problems
To: "Peschier, J. \(r&d\)" <Jeroen DOT peschier AT soz DOT pinkroccade DOT nl>,
"'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
In-Reply-To: <608FFE690078D3118A940000F87B142301CDC6E2@ASZMSG002.gak.nl>
MIME-Version: 1.0

--- "Peschier, J. (r&d)" <Jeroen DOT peschier AT soz DOT pinkroccade DOT nl> wrote: > 
> Hi!
> 
> I am having problem linking with the mapi library:
> 
> gcc -c MailTest.c
> gcc -o test.exe MailTest.o -lmapi32
> MailTest.o(.text+0x3f):MailTest.c: undefined reference to
> `MAPISendMail AT 20'
> collect2: ld returned 1 exit status
> make: *** [test.exe] Error 1
> 
> I've checked that the mapi.h headerfile provided by Cygwin provides a
> prototype for MAPISendMail. According to the FAQ linking this way to
> the
> mapi library should work. 



For some reason, that function name is not in the import lib for
mapi32.dll.    There may be a good reason for that or it may be an
oversight.  In the event, that is why you got the undefined reference.

An immediate solution is to load  mapi.dll at runtime (LoadLibrary) 
and use  GetProcAddress function to get the entry point

Danny











The code I'm trying to compile is below:
> 
> ---------------------------code MailTest.c:
> #include <windows.h>
> #include <mapi.h>
> 
> int main(char **argv, int argc)
> {
>     MapiMessage message;
> 
>     if (MAPISendMail(0, 0, &message, MAPI_DIALOG, 0) !=
> SUCCESS_SUCCESS)
>         printf("Something went wrong\n");
>     else
>         printf("There you go\n");
> }
> ---------------------------
> 
> I'm new to Cygwin but not new to gcc. I'm probably staring myself
> blind on
> something obvious here... Or perhaps it's a Cygwin or Windows 2000
> specific
> artifact that I'm unaware of? Anyway, thanks in advance for any help
> offered.
> 
> Jeroen Peschier
> 
>
----------------------------------------------------------------------------
> ASZ heet sinds  7 mei 2001 PinkRoccade Sociale Zekerheid. In verband
> daarmee
> zijn alle e-mailadressen van ASZ veranderd. Het nieuwe domein is nu:
> soz.pinkroccade.nl.
> Als u in uw adressenlijst nog e-mailadressen hebt staan met @asz.nl,
> gelieve
> dan de toevoeging ná de @ te wijzigen in soz.pinkroccade.nl. Vóór het
> @-teken zijn de e-mailadressen ongewijzigd gebleven.
>
----------------------------------------------------------------------------
> 
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
> 


_____________________________________________________________________________
http://messenger.yahoo.com.au - Yahoo! Messenger
- Voice chat, mail alerts, stock quotes and favourite news and lots more!

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019