Tom Messenger | 1 Jun 2005 03:08

Re: Q: Writing COM objects in Mingw - what"s the current state of play?

Reply-To: mingw-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org

> Q1. Is it possible to create COM automation servers in mingw?

Yes.

> Q2. Is it possible to use those servers from another language? I think
>this means the ability to implement Idispatch.

I believe the COM extensions for Python will let you access COM objects
directly, but you'ld need to implement IDispatch to support scripting
languages in general.

>Q3. Does anyone have a simple example of a working COM object in mingw
>that you"d be willing to share?

The standard COM samples from the Platform SDK show how to create COM
objects in C++ that support OLE Automation.

Ross Ridge

--
 l/  //   Ross Ridge -- The Great HTMU
[oo][oo]  rridge-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys@public.gmane.org
-()-/()/  http://www.csclub.uwaterloo.ca/u/rridge/
 db  //  
Marco Schwarz | 1 Jun 2005 12:25
Favicon

MINGW Beginner

Hi, I use mingw at the first time. I install the Version MinGW-3.2.0-rc-3.exe (with the current Version I have the same problem)

 

Source:

 

#include <stdio.h>

 

int main(int argc, char **argv)

{

        printf ("Hello\n");

        return (0);

}

Compiling:

uschma>gcc -o a.exe -c hello.c

Start the exe:

uschma>a.exe

There do nothing:

uschma>

 

 

Can sameone say me, what I make wrong?

 

 

Thanks Marco

 

PS Sorry my English is bad!

 

Marco Schwarz | 1 Jun 2005 12:27
Favicon

MINGW Beginner (Mail 2)

uschma>gcc -o a.exe -c hello.c -g

 

uschma>gdb a.exe

GNU gdb 5.2.1

Copyright 2002 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "i686-pc-mingw32"...

(gdb) run

Starting program: C:\Dokumente und Einstellungen\uschma\CPP_Project\demo/a.exe

 

Program received signal SIGSEGV, Segmentation fault.

0x0000013d in ?? ()

(gdb) c

Continuing.

 

Program received signal SIGSEGV, Segmentation fault.

0x0000013d in ?? ()

(gdb) c

Continuing.

 

Program exited with code 030000000005.

(gdb)

Matthew Low | 1 Jun 2005 12:34
Picon

Re: MINGW Beginner

Hi Marco,

Remove the -c flag from the command line.

Matt

On 6/1/05, Marco Schwarz <marco.schwarz@...> wrote:
>  
>  
> 
> Hi, I use mingw at the first time. I install the Version
> MinGW-3.2.0-rc-3.exe (with the current Version I have the same problem) 
> 
>   
> 
> Source: 
> 
>   
> 
> #include <stdio.h> 
> 
>   
> 
> int main(int argc, char **argv) 
> 
> { 
> 
>         printf ("Hello\n"); 
> 
>         return (0); 
> 
> } 
> 
> Compiling: 
> 
> uschma>gcc -o a.exe -c hello.c 
> 
> Start the exe: 
> 
> uschma>a.exe 
> 
> There do nothing: 
> 
> uschma> 
> 
>   
> 
>   
> 
> Can sameone say me, what I make wrong? 
> 
>   
> 
>   
> 
> Thanks Marco 
> 
>   
> 
> PS Sorry my English is bad! 
> 
>

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Brian Dessent | 1 Jun 2005 12:42
Favicon

Re: MINGW Beginner

> Marco Schwarz wrote:

> uschma>gcc -o a.exe -c hello.c

This is invalid.  The "-c" flags tells gcc to compile only, not link. 
Using it in this manner you are not getting an executable, but since you
force the output name to be a.exe you are trying to run an .o file that
is renamed to an .exe.  There is no way that will work.  Use "gcc
hello.c -o a".

Brian

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Marco Schwarz | 1 Jun 2005 12:47
Favicon

AW: MINGW Beginner

Thanks I understand.

-----Ursprüngliche Nachricht-----
Von: mingw-users-admin@...
[mailto:mingw-users-admin@...] Im Auftrag von Brian
Dessent
Gesendet: Mittwoch, 1. Juni 2005 12:42
An: mingw-users@...
Betreff: Re: [Mingw-users] MINGW Beginner

> Marco Schwarz wrote:

> uschma>gcc -o a.exe -c hello.c

This is invalid.  The "-c" flags tells gcc to compile only, not link. 
Using it in this manner you are not getting an executable, but since you
force the output name to be a.exe you are trying to run an .o file that
is renamed to an .exe.  There is no way that will work.  Use "gcc
hello.c -o a".

Brian

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

SourceForge.net | 1 Jun 2005 12:50
Picon
Favicon

[mingw - C/C++] RE: gcc4.0 configure g++


Read and respond to this message at: 
https://sourceforge.net/forum/message.php?msg_id=3179686
By: useradd

"You appear to be using Dev-C++ make.exe"
You are right, I change the make, the configure works. Thank you a lot.

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit: 
https://sourceforge.net/forum/unmonitor.php?forum_id=286529

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Philip Bock | 2 Jun 2005 19:38

CreateFileW failure


I apologize if this is considered off-topic.

I'm writing a program that needs to be able to open files on network
shares with extremely long paths. Looking at MSDN, I see that if I use
the Unicode version of CreateFile, and prepend the string \\?\UNC to
the paths, I should be able to do this.

The problem is that my CreateFileW (unicode) call fails consistently with
error 123: The filename, directory name, or volume label syntax is
incorrect. If I use CreateFile (non-unicode), everything works as
expected, but of course my paths are limited to 260 characters.

I'm running this on Windows 2000 Server.

My test program is below. Both example filenames fail in the same way.
There is a C:\winzip.log, and my user has permission to access it. I
thought for a while my convert_to_unicode function might be the problem,
but the printf outputs an identical string for both versions, so I think
this is working.

Does anyone have any suggestions?

Thanks, Philip Bock

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <windows.h>

wchar_t *convert_to_unicode(const char *in) {
	int c;
	wchar_t *out = malloc(sizeof(wchar_t) * strlen(in));

	for (c = 0; in[c]; c++)
		out[c] = (wchar_t) in[c];

	return out;
}

int main(int argc, char **argv) {
	HANDLE f;

//	char *filename = "\\\\?\\C:\\winzip.log";
	char *filename = "\\\\?\\UNC\\127.0.0.1\C$\winzip.log";
	wchar_t *wfilename = convert_to_unicode(filename);

	printf("%s\n%ls\n", filename, wfilename);

	/* Explicitly use Unicode to allow for long paths */
//	f = CreateFile(filename,   // Non-unicode: success
	f = CreateFileW(wfilename, // Unicode: failure
		GENERIC_READ,      // open for reading
		FILE_SHARE_READ,   // share for reading
		NULL,              // default security
		OPEN_EXISTING,     // existing file only
		FILE_FLAG_SEQUENTIAL_SCAN, // normal file
		NULL);             // no attr. template

	free(wfilename);

	if (f == INVALID_HANDLE_VALUE) { /* Failed to open source file */
		printf("Failure: %lu\n", GetLastError());
	}
	else {
		printf("Success!\n");
		CloseHandle(f);
	}

	return 0;
}

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Benjamin Riefenstahl | 2 Jun 2005 20:14

Re: CreateFileW failure

Hi Philip,

Just some random thoughts. 

Philip Bock writes:
> wchar_t *convert_to_unicode(const char *in) {
> 	int c;
> 	wchar_t *out = malloc(sizeof(wchar_t) * strlen(in));
>
> 	for (c = 0; in[c]; c++)
> 		out[c] = (wchar_t) in[c];
>
> 	return out;
> }

The result of this function is not NUL-terminated.  Also this function
only works for filenames containing only ASCII characters.

> //	char *filename = "\\\\?\\C:\\winzip.log";
> 	char *filename = "\\\\?\\UNC\\127.0.0.1\C$\winzip.log";

I am not sure that this will work when you refer to local files via
UNC paths in this way.

It's also possible that it works with regular UNC paths but not with
these \\?\ paths.  There is, after all, a reason for the usual size
restriction: It gives the OS the chance to parse the file name and to
fixup all kinds of strange irregularities, and those might include UNC
access to local files.  You don't have such conveniences with \\?\
paths.  But I admit that is all speculation.

benny

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Egon Andersen | 2 Jun 2005 20:47
Picon

Re: CreateFileW failure

Philip Bock wrote:
[snip]
> 	char *filename = "\\\\?\\UNC\\127.0.0.1\C$\winzip.log";

Shouldn't it be:
char *filename = "\\\\?\\UNC\\127.0.0.1\\C:\\winzip.log";

i.e. \ should be \\ and I expect $ should be :, but the later I'm not 
sure about.

Best regards
Egon Andersen

--

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users


Gmane