News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Linking a Masm32 routine to G++

Started by jj2007, August 19, 2015, 05:20:39 AM

Previous topic - Next topic

jj2007

Anybody managed to use a Masm32 algo in G++? It throws e.g.

error: expected constructor, destructor, or type conversion before ';' token

for

extern "C" __stdcall atodw(char *szStr);

int main(void)
{
    int somenumber=atodw("123");

Vortex

Hello Jochen,

You need to specify the return type of the function in the declaration :

extern "C" void __stdcall StdOut(char *szStr);

int main(void)
{
    char s[]="Hello world!";
    StdOut(s);
    return 0;
}



set PATH=%PATH%;\MinGW\bin

g++ -c hello.cpp

g++ -static-libstdc++ -static-libgcc -s hello.o -o hello.exe \masm32\lib\masm32.lib

jj2007

Thanks, Erol. The hello world is working now.

jcfuller

Jochen/Erol,
  Isn't that a violation of Hutch's masm32 library use policy?

James

hutch--


jcfuller

Ok,
now I remember why I could not use it; but to be fair it was several years ago and my memory fades more every day.
Item #4:
You cannot use the MASM32 Project to write software for Non-Microsoft Operating Systems
when I was tinkering with jwasm on Linux
:)

Hutch,
  That was also a Microsoft restriction was it not?
Now that they are providing  cross platform compiling with Visual Studio 2015 will that be relaxed?

James

Vortex

Hello Jochen,

The C equivalent :

extern void __stdcall StdOut(char *szStr);

int main(void)
{
    char s[]="Hello world!";
    StdOut(s);
    return 0;
}


set PATH=%PATH%;\MinGW\bin

gcc -c hello.c

gcc -static-libstdc++ -static-libgcc -s hello.o -o hello.exe \masm32\lib\masm32.lib


hutch--

> Now that they are providing  cross platform compiling with Visual Studio 2015 will that be relaxed?

Nope.

I am inclined to return back to GPL what I get from it, nothing.