Re: [Dev-C++] assembly (not inline!)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2004-07-07 14:58:49
|
Check out vesa graphics - a bios extension to control high-resolution graphics. I would actually recommend that you use the djgpp compiler instead of mingw. djgpp is also a gcc port, but building dos applications with dos-extender to support much memory and protected mode. Scan through the following links: http://www.google.se/search?q=vesa+graphics+programming&ie=UTF-8&hl=sv&meta= /Per W On Tue, 6 Jul 2004, Paul Ingelbrant wrote: > Quoting Marco Ribeiro <ma...@ne...>: > > > Hello all, > > > > > > > > I wish to know if is there a way to make a function in assembly, compile it > > in masm and then use it in c++. I search the web but found nothing about it. > > My idea is something like linking the masm result with my c++ program. > > > > Have you looked at http://www.masm32.com/ ? > > A would guess that masm produces a normal object file. Just declare the function > as extern C to avoid problem with name-mangling. > > Hmm... need to try it before saying too much... > > downloading masm32... > > (some sounds of your choice to illustrate work) > > Results: > > I tried this simple example: > > > .386 > .model flat,stdcall > option casemap:none > > include \masm32\include\windows.inc > > .code > asmfunc proc inp:UINT > mov eax, (inp) > add eax, 10 > > ret > > asmfunc endp > > end > > > linked the resulting .obj (project->project options, parameters add library or > object) with the following: > > #include <iostream> > #include <stdlib.h> > > extern "C" int asmfunc(int); > > > using namespace std; > > int main(int argc, char *argv[]) > { > > int x = 15; > x = asmfunc(x); > > cout << x << endl; > > system("PAUSE"); > return 0; > } > > > I do get a linker warning, but it does work. > > > So, I guess the answer is yes... > > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |