GithubHelp home page GithubHelp logo

Comments (5)

millerta avatar millerta commented on August 26, 2024

These files are in /src directory and were used to setup and test the wrappers.
lg_example.cpp lg_example_fortran.f90

The routines can be called by using user_sub.f and compiling.
Attached is an example.
user_sub.f.txt

from lagrit.

millerta avatar millerta commented on August 26, 2024

See code on branch tam-debug
The code flow of msgtty and dotask makes debug more difficult. The error of losing the first word actually happens when msgtty is called a second time from the command stack routines. At this point the first word or "command" has already been parsed and the second call has the command missing. The error has happened already, in passing parameters to dotask() which should not have called msgtty in efforts to solve the commands.

I added dotask_test() and associated c-fortran wrappers and files to enable testing of the c-fortran wrappers.
This code is same as dotask, but avoids the command routines and does nothing except report what dotask
has received from fortran or cpp routines that call it.

Running this new wrapper shows there is a size error in the parameter passed from cpp to fortran dotask_test()
parameter err is declared as int_ptrsize which dotask expects as integer 8.
But in cpp sizeof(err) shows 4

This is fixed by adding type_sizes.h which defines int_ptrsize as size as null which is 8.
This is sometimes corrected by compilers, but in some newer compilers it is not.

Inside C wrapper lg_dotask_test
received string: 123456789
string length: 9
  sizeof strlen: 8
  sizeof err: 4
  sizeof hidden length: 8
sending parameters to FORTRAN dotask_test
send string: 123456789; finish
string length: 17

 Begin FORTRAN dotask_test
 parameter integer size:                     8
   received string: 123456789;
   length:                    10

from lagrit.

millerta avatar millerta commented on August 26, 2024

The files added and modified for dotask c-fortran testing include:

new fortran dotask_test.f - dotask_test copy of dotask without global commands
lg_c_wrappers.cpp - DOTASK_TEST wrapper to fortran dotask_test
lg_c_interface.h - declare C lg_dotask_test
lg_f_interface.h: - declare fortran extern void DOTASK_TEST
CMakeLists.txt - add DOTASK_TEST to symbols for name mangling in fc_mangle.h

from lagrit.

millerta avatar millerta commented on August 26, 2024

The following commands have been added to msgtty for testing during execution.

test (no second word) - easy test using createpts to check executable
test list - list available options
cpp -  call dotask and c-fortran wrappers using get_info calls to get pointers from fortran
fortran - call dotask and get_info pointers used by cpp
dotask - call dotask_test which avoids global commands and just tests dotask parameters

from lagrit.

ehinrichs avatar ehinrichs commented on August 26, 2024

Update files to include:

#include "type_sizes.h"

For any file that use int_ptrsize. This allowed dotask to correctly interpret the int_ptrsize as being 8.

from lagrit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.