473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to call a assembly implemented function in C++??

6
I used to use Dev C++, and this year i started to use C++ Builder and Visual Studio too.
I use ml.exe to assembly my .asm and get a .obj.
In Dev C++ there's no .obj, there's .o so i have no idea what i have to do.
In C++ Builder i have read i must to do:
1
ml /c /Zf /omf function.asm
to obtain the .obj
2 Add the .obj to the project
3 Introduce this line before as a kind of include (declare the function)
extern void estados (char* , char* , char* , int , int );

the problem is that this works in a C project, but not in a C++ project and i want a C++ project.

In Visual Studio
i have to add the .asm to the project and, in the properties of the file change this in Custom Build Step:
command line: C:\rede2\rede2\ml /c /Zf /omf function.asm
outputs: function.obj
(Of course, that depends of the location of ml.exe)
But i get an error message like this:

invalid or corrupt file: cannot read at 0x2CE function.obj line 1

Can anyone help me in any compiler???
thanks since now.
Jun 13 '07 #1
4 1992
weaknessforcats
9,208 Expert Mod 8TB
The most I know how to do is use the __asm keyword for Visual Studio.NET 2005.

However, this is Microsoft specific.

This example is from the Microsft docset:
Expand|Select|Wrap|Line Numbers
  1. __asm {
  2.    mov al, 2
  3.    mov dx, 0xD007
  4.    out dx, al
  5. }
  6.  
  7.  
What this does is call the inline assembler.

Check it out.
Jun 14 '07 #2
timon
6
thank you!!
but, let me ask you another question.
if i had, for example, pointers (or another variable). how can i move this data to the registers
ex.:
Expand|Select|Wrap|Line Numbers
  1. char* myPtr = new char[20];
  2.  
  3. __asm {
  4.  
  5.      MOV CX, 20
  6.      MOV EAX, myPtr
  7. bucle:
  8.      MOV [EAX], 0
  9.      INC EAX
  10.      DEC CX
  11.      JNZ bucle
  12. }
  13.  
????????
i don't know if i can do that, so how i can do this??
Jun 14 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
This is my jumping off point. I'm just a C++ person. However, I would like to know how to do that so I can amaze my students.
Jun 15 '07 #4
drhowarddrfine
7,435 Expert 4TB
If you leave the pointer in eax then:

mov ebx,[eax]

would put the data pointed to by eax into ebx.
Jun 15 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: ZhangZQ | last post by:
Is it possible to dynamicaly to local and call a function in Win32 dll(not a ..net assembly dll) in C# at run time, for example, a C# program popup a dialogbox to let use input which Win32 dll to...
4
by: Gnanaprakash Rathinam | last post by:
Hi Expert, Is there a way to obtain assembly name in an unmanaged call? During Interop call between managed to unmanaged, I would like to know in unmanaged code about the caller of assembly file...
5
by: Adrian | last post by:
Is there a way (understandably non-portable) to get the call stack from within a function? That is, assuming the application has been compiled with symbols, get the list of calling function names...
7
by: alice | last post by:
hi all, Can anybody please tell me that how an assembly language code can be called from a program written in C?I mean what is the syntax for doing this thing? Thanks, Alice
4
by: Jonathan Roewen | last post by:
Hi I've got loading assemblies dynamically done (wasn't too difficult). Now I want to lookup a static function in the loaded assembly, and if found, return it somehow, and call it from my app. So...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
0
by: Scott James | last post by:
This seems like a strange one, but perhaps someone can shed some light. I have an interface: ItciEngine implemented by class tciEngine. Two public methods in this class pass an object I've...
2
by: Jan | last post by:
Regarding my post "CSharpCodeProvider: referencing other generated "InMemory" assembly" 4/27/2006 and the blog from Greg Young http://geekswithblogs.net/gyoung/archive/2006/04/27/76533.aspx I...
9
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.